What if the buyer withdraws from purchasing real estate in the USA; are they entitled to a refund of the deposit paid?

Refundability depends on contingencies: if you cancel within an inspection, financing, or other contingency period under the contract, you usually get your earnest money back; otherwise the seller can generally keep it.​