For those saying this is stupid, this is pretty much how all EVs currently operate. The EPA mileage ratings (MPGe) for EVs calculates mileage starting with kWh in the battery. That is, it isn't a measure of energy efficiency from source to wheels on the ground. It ignores electricity generating losses, transmission losses, and battery charging losses. (This makes sense since how your electricity is generated depends on where you live. If you based MPGe on the national average, then you'd be overstating it for EV owners in areas where electricity has high losses (coal), understating it where electricity has low losses (e.g. hydro). So starting with kWh in the battery is really the only way you can come up with a MPGe figure which is correct throughout the country.)
So how much are these losses? Here's a chart of U.S. energy generation and consumption. [Edit: site won't let me post a link since this is a new account. Just search for "u.s. energy consumption by source and sector 2022".] Note the section on the electrical power sector in the bottom middle. Note that it says 65% losses. It's actually not quite this bad. The chart is used as a measure of electricity generating capacity, so to equalize renewables with fossil fuels it assigns renewables equivalent losses. i.e. If you generated 1 kWh of electricity using solar, the chart would say solar actually generated (1 kWh / 0.35) = 2.86 kWh, so that the solar distributed to end-use (after removing the 65% losses) is 1 kWh. Correcting for this, and you get that our electrical grid is about 46% efficient. For every 100 kWh of energy in the source fuel (oil, coal, gas, nuclear heat, renewable), about 46% of it becomes electricity delivered. That accounts for generating losses and transmission losses (which are about 5% if you're curious).
Charging losses fortunately have been measured by numerous Tesla owners. I've seen figures between 75% to 90% efficient. I'd say the average is about 85% efficient. i.e. To put 85 kWh into the Tesla's battery pack, you need to draw 100 kWh from the grid.
So the EPA rates the Tesla S at 120 MPGe. Multiply that by the efficiency of the electrical grid (46%) and charging efficiency (85%), and you get a real MPGe (measured as energy from the source to energy delivered to the wheels) of 46.92 MPGe if you charged it via power outlets. Barely better than the 45.69 MPG they got with a diesel generator on board.
Note that if the diesel generator (which suffered 85% losses charging the battery) had been powering the Tesla directly, it would've gotten 45.69 MPG / 0.85 = 53.75 MPG. Beating out the energy efficiency of the Tesla charged from the grid. (That's not really fair though since the peak efficiency power band of an ICE is rather narrow. You'd fall below that MPG every time you deviated from that peak, e.g. accelerating from a stop. The generator had a much easier time since it could run continuously at the efficiency peak.)
EVs are nice as an endgame tech and to reduce tailpipe emissions (though the emissions end up coming out of power plant smokestacks instead). But in terms of energy efficiency, they're rather pointless until we shift the majority of our electricity generation away from fossil fuels.