This does happen; fortunately, not too often. The situation is more likely to occur in a “sellers market“. Sometimes the sellers want to back out for a legitimate reason like job transfers falling through, an illness, loss of job, divorce etc. In these circumstances, the best thing to do is agree to cancel the contract, especially if the sellers are willing to reimburse you for out of pocket expenses such as appraisal fees, home inspection costs and so on.
On the other hand, some sellers and their agents are manipulative and greedy and they just want to renege on the deal so they can accept a more favorable offer and make more money. If you find that the sellers want out because they have a better offer, there are things you can do to make them stick to the contract. Of course, this depends on you really wanting the house and being willing to force the issue.
You, the home buyer, have spent weeks, or longer, looking at houses and you finally found one that meets your needs. You write an offer for full price because you really want it to be accepted and you think the house was under priced to begin with. You, or your agent, present the offer to the sellers and they accept it, as written, with the contingencies you have included (appraisal, finance, home inspection etc.). Your earnest money is deposited in an escrow account and the contract is ratified. You go ahead and order the inspection and apply for your loan. Three days later the inspector goes to the house and the sellers refuse to let him in, telling the inspector that they have changed their mind. What can you do?
Obviously, you can hire an attorney who specializes in real estate law and put the matter in his hands. However, if you don’t want to go to the expense and trouble of that route at first, all is not lost as you can bring pressure to bear through your Realtor. Even if you don’t have a Realtor, and you are buying from a FSBO, you can still apply pressure if you have used the correct format in your offer/contract. Providing you have a properly executed contract, the sellers can’t unilaterally cancel the transaction. For them to be able to do so, you would have to be in breach of some of the terms agreed upon. You must be very careful if you are continuing with unwilling sellers to make absolutely certain that you do not let anything slide or you could end up losing the house. Be aware that these sellers are unlikely to agree to any repairs of defects found during your home inspection and you will have to decide if you can accept things as they are. (If there is a major construction flaw then you would want to cancel anyway.)
O.K., you want to put pressure on these greedy sellers to perform. If the sellers are represented by a Realtor, not just an agent, you will have a better chance of success. Realtors must abide by a strict code of ethics and what the sellers are trying to do is definitely unethical. If the Realtor endorses what their sellers are doing then he can be brought in front of the ethics committee at the Board of Realtors and fined and/or have his membership in the Board revoked.