If the Title Company says that the deed/title cannot be released and transferred with the HOA lien on there, someone will have to pay it.
Banks are notorious for letting hundreds of thousands of dollars slip through their hands on a sale just so they don't have to pay a few hundred for some small thing.
If you are very close to closing on this contract and the bank won't pay, you will need to decide if it's worth it to you to pay the outstanding HOA dues in order to get the property.
Please take the following as the ramblings of a real estate practitioner and NOT an attorney:
If this is an REO property and the bank owns it, then they own it by virtue of a completed foreclosure or a deed in lieu. It should not have been listed for sale if there was still an HOA encumbrance on the property. HOA debt is usually wiped out by the foreclosure process. However, there are a few HOA's that will not subordinate their lien. You cannot buy or refinance a home in these subdivisions unless the mortgage company agrees to take 2nd position to the HOA. In these cases the 1st lien is actually a 2nd lien, and, as a result of the pecking order, the HOA could potentially foreclose and wipe out the bank. If this is what you are dealing with then it is in the banks best interest to settle with the HOA. If the bank won't play fair, then you might want to terminate the deal or consult a real estate attorney to help you examine other options.
If the property was posted for foreclosure but it has not yet gone to auction then you are dealing with a pre-foreclosure situation -- most likely a short sale. Legally, the property is still owned by the borrower but the borrower's bank must approve the price and terms of the sale. In such a case, HOA debt becomes a negotiable matter. Someone must settle up with the HOA in order to provide clear title to the Buyer. The best candidate is the Seller if he has any money. However, short sale Sellers usually lack the funds to cover the payoff amount. Next comes the bank in the person of the short sale negotiator. They will sometimes agree to take on the HOA debt as a Seller closing cost even though it increases the shortfall to the bank. Finally, if push comes to shove, it might be in the Buyer's best interest to settle the HOA debt if, and only if, the deal still makes sense and the first 2 options are ruled out.