And if they don't use gasoline, they get infinite miles per gallon. If the car has serious battery capacity like the Chevy Volt, it can get you to work and back on pure battery power. You recharge and off you go the next day.
As a publicity stunt, Chevy ran the Volt (or a computer simulation of the Volt) thru the EPA mileage test, and reported that the Volt was good for 230 mpg (pretty damn close to infinite compared to the 20 mpg a minivan gets). The number attracted attention, and then denunciation. As a publicity stunt it was good.
Now, comes a long serious discussion about how to assign an mpg rating to electric or hybrid gas/electric cars.
The real answer is, it depends. Depends upon how long a trip you are talking about. Short trips, where the battery can make the entire trip show infinite gas mileage. Longer trips beyond the range of the battery will show about anything you like. A trip of twice battery range will use less gas than a trip of 4 times battery range. The real answer, is miles per gallon doesn't mean much for electric cars, or at least electric cars with serious battery capacity.
The current hybrids have tiny batteries, just large enough to hold the energy created by braking and feed it back upon acceleration. The "pure battery range" is a few hundred feet or less. For reasonable trips of miles, the car is running on engine power nearly all the time and mpg has some meaning. But for future electrics with serious battery capacity, that can do a daily commute on battery power, mpg doesn't mean much.