I use a credit card. With the receipt I always know the cost/gallon, total cost, and amount of fuel. I always divide total cost by the cost/gallon to be sure it agrees with the amount before I calculate my mpg/tank... which is seldom that accurate in itself, but it can be used to get the actual if you keep records, as well as for experimentation, in which I have long discovered that not topping off (I just pump to the next .1 (ten cents)), filling at dark (especially in the hot weather) and keeping tires consistently and evenly inflated each matter for about 0.34 mpg. Pumping on low speed improves mpg about 0.6 mpg. And don't fill up when there is a delivery going on-- but it's harder to experiment regarding that. In short, keep all related elements even and minimize the vapor pressure of the fuel (don't jostle it more than necessary). But the vast majority of people are too impatient and myopic to do these things, so more fuel for more cost to drive the same distance is where they rest.
BTW I hate the idea that it is illegal in NJ (and now I gather other places) to have self-service. Besides the higher costs, don't imagine that they don't know these little tricks of how to use more fuel for the same driving, and that they don't do them to you. If you were to ask them to fill your tank on low speed, they'd probably say that's illegal, too-- or else, just tell you not to come back and hold them up again. This must be unions shoving their illogical sauce to fleece you and keep Horshack's job.