The units don't actually
cancel because it's confusing a common name for different things. Specifically, "miles per gallon". The bottom unit is not
units of volume! If you write it out, it becomes "miles per gallon of gasoline", where "gallon of gasoline" is a unit of energy, not volume. If it was merely a unit of volume we could measure car efficiency in units of 1/distance^2, which is how it's being used in the comic.
If we just look at the types of units, they don't cancel. This is how I initially approached it, checking for error.
(energy / pressure) * ((distance/energy) / distance)
Which leaves 1/pressure, which is definitely not unitless. (That's the whole reason I came to the forum to see if anyone had noticed this yet.
Of course, making mistakes is the point of the comic.