I don't think OP was saying that. The pump asks Y/N if you want a receipt before you pump, but prints it after the pumping.
That said, you do specify the amount of gas if you're paying cash here in the US. You go inside, say "here's $20", and the pump will dispense exactly that.
If you're paying with cash you usually have to prepay. If you're paying with card the station does a preauth on your card (and usually a temporary hold) then does the final authorization after you finish pumping and it knows the total. Sometimes you have to pump twice if you want to go over the preauth hold amount, which is usually $50.
It's worth noting that it wasn't that way the entire time I was growing up. You would pump first then pay the cashier. It wasn't until around 2005ish that I noticed signs instructing cash customers to prepay.