This would be a good question for a local Realtor. The contract should allow for an inspection period. A good "buyer's agent" should be able to add a contingency to the contract that would protect you and let you retain your earnest money deposit if the inspection results are not to your complete satisfaction. The only out of pocket expense you would incur would be the cost of the home inspection.
If you have an Inspection CONTINGENCY, then you can certainly walk away.
If you do not have the CONTINGENCY, and you are not using a Realtor; then; WHY NOT?
Homestead Realty Inc