Fluids (including natural gasoline/petroleum) have variable volume based on the ambient temperature for the same mass of fluid. So, really, the amount of gas that you're filling your car with depends on the temperature because it's not the volume of fuel that makes your car run, but the mass which is combusted. In aircraft, aviation fuel is always measured by the kilogram. So, why is it measured by volume for cars?
I take it that the question being asked by OP is :
"""...Why is gas(oline) in gas stations sold by volume (as opposed to mass)?..."""
The answer is simple. Gas stations get their gasoline delivered by "jobbers" who can supply them with gasoline that can come from a variety of different sources; even from different manufacturers. Gas stations are equipped with simple equipment that can measure fluid VOLUME, and as most liquids, are of low compressibility (not zero), that is a fairly reliable measure (for commerce).
No gas station is equipped with any kind of equipment that can measure MASS which is a rather complex physical parameter to measure, and requires highly specialized equipment.
On the other hand, If I have read the question incorrectly, then forget that I gave an answer.
CNG fuel dispensers indeed measure mass not volume. Mass flow meters (coriolis)do that job. Pakistan has the biggest number of CNG vehicles as its a bit low cost(India is lagging behind Pakistan in CNG:) @Qmechanic wrongly edited your question.
First of all in aviation (from my previous work in this field) fuel usually measured by "US Gallons" which is a measure of volume, anyway usually in big tenders sometimes they measuring it in Tons (for a what called Jet A-1 class of this fuel -used for aircrafts- it is 1 Ton=331.3 US Gallons if I remember it right).
And regarding natural gas, the fact that up to a very high precession, most liquids can't be compressed, thus if you compress the gas to convert it into liquid, and knowing the density, you can always calculate it's weight, and this is very comfortable because it's much more efficient to transport gases in their liquid form.
Also considering natural gas heat capacity and temperature expansion coefficient, in usual temperature conditions it's volume changes in a very small amount, and I believe that it's much easier to dial with liquid gas in the car's engine than in it's normal state.
Finally, in your place, I would worry more about the "Energy conversion efficiency" of the gas, because usually the natural gas comes with a lot of other gases, that are not useful -in sense they can't burn in usual conditions-, this may cause your car to walk 50 km instead of 200km using same amount of gas.