But you are ignoring how the electricity gets to the motor. Go through the variable speed drive, inverter, battery, charger, local transformer, distribution lines, substation, transmission lines, step-up transformer, generator, steam turbine, boiler and furnace. Then we can have a discussion of efficiency.
The same could be said for oil drilling, pumping, shipping, refining, and delivery.
All that ultimately matters is dollars per mile. And electricity costs about one-third what gasoline costs on a per-mile basis. Actually it can cost even less because electric companies are starting to offer discounted or even free nighttime charging.