18 gallons of gas to fill car
.25 difference per gallon.
5 mile drive each way. So that's 10 miles or 1/3 gallon - or around 1.40 spent on the drive.
And saved 4.50 on the tank.
So......
BONK!!!!
Unstated assumption:
30 mpg.
That's great for you, but the average car on the road is 12 years old, at this point. MPG for the average 2010 car was about 21.5.
Using your distance calculation, it's about half a gallon - still saving money, but only $2.25
Except that your assumption only includes the cost of gasoline. Current IRS per mile estimate for the cost of operating your vehicle is $0.625 per mile driven.
Your 10 miles driven costs you $6.25 gas plus wear and tear on your vehicle, to save $4.50.
And all of that assumes your time isn't worth anything, either - your point about the line at CostCo is well taken. Combine the trip with shopping you need to do anyway and the trip likely makes sense, despite the car usage and time.
But just for gas? Not worth it.
Over 40% of shoppers go to more than one store, "to find the best deals."