How much energy does it take to produce and get 1 gallon of gasoline into a gas tank - all factors included? And how much energy does it take to put the equivalent energy of 1 gallon of gasoline energy into an EV battery - all factors included?
It's good to recognize that very little energy is consumed getting gasoline to the filling station. While it does not directly answer the question, it's pretty much an insignificant number, and gas to the tank is roughly equal to getting energy to a power plant.
It really does not matter all that much. The energy consumed matters 32 times more.
Where the EV shines is the electric motor converts 90% of a batteries energy into rotational power. The best fuel powered engines are 44% efficient (diesel) and 41% efficient (Toyota hybrids). The best power plant is 54% efficient at the power plant's fence.