Surely you have noticed the decals on gas pumps stating when they were last tested for accuracy ...
I happened to stop by a gas station today while the pumps were being tested. I asked the guy doing the testing a few questions and he got rather chatty - he really likes his job. For the most part gas pumps are usually pretty accurate - he rarely sees pumps off by significant amounts.
How its done:
They pump 5 gallons (640 ounces) into a special container that has mechanical apparatus with a glass tube and a scale next to it calibrated in cubic inches. The threshold for a pass or failed test is 6 cubic inches low (6 cubic inches = 3.324 ounces).
So for every gallon (128 ounces) you pump, you should get no less than 127.3352 ounces (if I did the math correctly).
The guy also tests liquid propane and heating oil trucks. I asked about their accuracy. He said "no comment" with a "look" to convey he has seen those off by a fair amount.