A pre-approval for a home loan is not a binding contract. If the lender subsequently declines you there is nothing to prevent you from going to another lender to see if you can get approved for a loan to purchase the same home.
The offer to purchase that you put in on the home is a binding contract. Hopefully you had the services of a good, local real estate agent that wrote the contract to protect your earnest money and included a financing contingency.
It is legal for a lender to issue a pre-approval and then subsequently decline the loan only if the pre-approval was in writing and included conditions that were not met. If the pre-approval was not in writing and / or did not include conditions, I would recommend that you seek the services of a good, local real estate attorney.