What if You Just Change Your Mind?
Then the money is genuinely at risk. A buyer who walks after their contingencies expire, for no contractual reason, is in breach. Standard Massachusetts P&S language commonly makes the deposit liquidated damages — meaning the seller's sole remedy is to keep it, but they do get to keep it.
Whether that language is in your agreement, and whether it caps the seller's remedy at the deposit or leaves you exposed to more, is a negotiated term. Read it. This is the single clause in the document with the largest possible dollar consequence for a buyer.
How Large a Deposit Should You Offer?
In a competitive situation, a larger deposit is a credible signal — it says you have the cash and that you are confident enough to put it at risk. It costs you nothing if you close, because it is credited to your purchase.
The honest counterweight: it is only free if you close. A large deposit is exactly the wrong move for a buyer whose financing is shaky, whose down payment is coming from a house that has not sold yet, or who is buying a condominium in a building that has not been vetted for lender warrantability. Match the deposit to your actual confidence, and let your agent tell you where the real risk sits.
General information, not legal advice.