It used to be a security thing, but that seems to have completely fallen by the wayside. I think these days it's basically just formally indicating that you're agreeing to make the purchase at hand, so you can't later go back and say that you somehow didn't realize you were handing over money, or that you thought you were paying less than you were charged.