It is illegal to sell the property without disclosing the lien: if the lien had been disclosed to you and you elected to buy the property anyway, that is your choice and perfectly legal. But to fail to disclose a  lien is to commit fraud and also to violate the contract of sale (which required, unless noted otherwise, clean title). You could potentially sue the seller (if it's not been too long; after some number of years, the "statute of limitations," or time period within which to sue, expires and you can't bring a legal action) for any loses or costs this causes you; you should also contact your title insurance company, which should protect you against this.