CNBC had a special on Costco and at least for the products they sell, their margins are razor thin (14 - 15% gross) vs. much higher overhead at say super market (I forgot the number, I think it was 20 - 25% gross margin).
Most of their profit is apparently made on membership fees.
So they probably have lower overhead vs. gas station and use the cheap gas to draw more people into their warehouses.
The special also said that some of the high end stuff they sell is grey market, because founder directly said on special, he felt regular distribution channels were charging too much.