A buyer can lose a deposit if the deal collapses for a reason the offer does not protect against, such as walking away after every condition was already satisfied or waived, since at that point the contract is considered binding and the seller can have a legitimate claim to the funds.
A buyer who withdraws properly under a live condition, such as financing or a home inspection that turned up a real problem, gets the deposit back in full, and any dispute over which situation applies is resolved between the lawyers using the trust rules the brokerage operates under, rather than by either side just taking the money.
Joel Dyck makes sure a buyer's conditions are written to actually protect their deposit, not just to look protective on paper. Get your hand-reviewed valuation from Joel Dyck.