The purchase and sale agreement defines your intent to buy the home. In the contract, you may stipulate certain contingencies, which would release you from the obligation to buy the home and allow their deposit to be returned.