It might be legal (or might not, depending upon several things), but it is poor business to allow this to happen. That money should be in an escrow account, where neither party have control of it. If it was cashed in put into an escrow account, that is fine. If put into the seller's pocket, as you imply, that is not so fine. If you end up not being able to buy the property, you better hope the seller still has the money and has not spent it.