They don't instantly take your money. It's instantly made unavailable to you, but it's still held by your bank for a bit before they receive it.
When they refund money to you, it's instantly unavailable to them, but is still held by their bank a bit before you receive it.