This is why credit cards are, I kid you not, one of the crowning achievements of the 20th century: there is no guarantee and they still work. Even before we had constant-on connections which could phone home and verify with a database, possession of plastic which looked mostly cardlike was Good Enough (TM) to suggest that a bank trusted a bank trusted a bank trusted you to make good on your debts, and accordingly the hotel/restaurant/bookstore/etc should grant you services immediately on the assumption that you'll settle up as promised and not attempt to cheat them.
The best guarantee you get when you run a card in the US is "As of the current instant in time, that card is valid and has sufficient credit on it to cover the amount you just charged", but that is very far from a guarantee that the charge will actually be settled without incident. But it's still good enough.
(And if you're scandalized by this, ask me about checks!)