Postscript: There's no free lunch, or in this case free gas.
I'm sure if you shopped smart, bought things on sale, purchased some things in bulk, and tried to combine trips to the store, you would probably end up saving money by shopping locally - even considering the price of gas (assuming you are within a reasonable distance to a supermarket).
Amazon offers non-perishable items in fairly large quantities. For example the Amazon Grocery offers a box of seven 24.3 oz "Kellogg's Frosted Mini-Wheats" for $28.77 or $4.11 a box.
Safeway.com offers the same box of cereal for $4.74, which makes Amazon look pretty good, if you buy things like cereal at full price. My local Safeway not-infrequently offers cereal at 2 for 1 prices. With the 2 for 1 deal I pay $2.37 per box.
I end up paying $8.22 for two boxes of cereal at Amazon and $4.74 at my local store...that leaves me $3.48 to buy a gallon of gas.