The last comment pretty much sums it up exactly for every gas station, they’re not all just coded as gas stations, even some of the ones that literally only sell gas, it’s kind of insane.
Obviously having that card means Costco is the best option on gas for you but they’re just out of the way sometimes. Basically you’ll just need to test the ones you want to use and probably pay at the pump to see what triggers the cash back, then pay inside on the ones that worked to see if it’s inside and outside.
It is annoying. When traveling I usually just pay at the pump at truck stops and seem to have the best luck with that.
The big exclusions I’ve noticed myself are Wal Mart, Sam’s Club and grocery stores with gas stations, but as stated before, this can highly change from one location to another, even if they’re the same name.