“Problem is that if the electricity is being produced by a gasoline or diesel motor (like in a train), the inefficiency of the source of the electricity has to be factored in.”
Only the electricity is NOT produced by gasoline or diesel motor.
Where I live it’s produced by burning coal. YMMV.
Now, if we could use nuclear power to power electric cars, that really would be a game changer.