1 Joule is 1 Watt second.
1 kilowatt hour is 1000[W] * 60[sec/min] * 60[min/hour] = 3.6 million Joules.
1 kg gasoline yeilds about 45 million Joules when fully combusted in air.
The relative density of gasoline compared to water is about 0.75.
1 gallon of water is 8 pounds.
1 gallon of gasoline is about 8[lb] * 0.75 = 6 pounds.
6 pounds is about 6[lb] / 2.2[lb/kg] = 2.7 kilograms.
The energy content of of gasoline is then 2.7[kg] * 45 [MJ/kg] = 123 million Joules per gallon.
With a generator to consumer system efficiency of 25% the energy yeild of gasoline is then 123[MJ] * 0.25 = 30.6 million Joules per gallon.
If electricity costs $5 per kWH then we have the following cost equivalent:
( $5 / 3.6[MJ] ) * 30[MJ/gal] = $42.6 per gallon.
If, on the other hand, the cost of electricity is only $0.11 per kWH then we have a different cost equivalent:
( $0.11 / 3.6[MJ] ) * 30[MJ/gal] = $0.92 per gallon.