At the time you made your offer, the seller was accepting only cash offers.
Sellers change their minds. They'll put a house on the market for $300,000, reject one offer for $280,000, then 3 months later accept an offer for $275,000. They'll get an offer contingent on the buyer selling an existing property and reject it. A few months later, with their house on the market, they'll get another offer contingent on the buyer selling a property . . . and accept it. They'll put a house on the market and, when it doesn't sell, they'll rent it.
It's legal for sellers to change their minds on what they consider an acceptable offer. (Once both parties have signed a contract, then they can't change their minds . . . to oversimplify. But without an agreement agreed to by both parties, mind-changing is par for the course.)
I agree with John that it would have made sense--once the sellers decided they didn't need an all-cash offer--for them to have contacted you and invited you to resubmit your offer. They may have figured that--months later--you would no longer be in the market. So it sounds as if the sellers made a number of strategic errors. But doing so isn't illegal.
Hope that helps.
I personally think CASH offers are the most risky.
I've probably had more cash buyers not be able to come up with the cash, or not show up at closing, or bail at some point, vs financed buyers.
But there are some homes that can only go cash.....for example these days it is tough to get financing on homes that have structural issues.
This is frustrating sometimes when a seller won't take what you think is a good offer or great offer or at list price, but it happens.
There will be a better home at a better price out there for you, so keep after it, you'll find it.
There are a bunch of great houses out there. Just get back on the horse and put this one behind you and start looking again. I'm sorry this incident happened and wish there was something you could do.
Good luck! I hope you find an even better home and this whole deal will end up being a blessing.
In any event, NO – it is not illegal for the seller to make a bad business decision in regard to declining you offer.
I hope that you have better luck in the future.
Best, Terry Bell, Realtor, Santa Rosa, CA