I have been in the mortgage field for almost 2 decades & have seen this happen time & time again. Of course the best thing to do is consult with an attorney. Hopefully you and your ex are divorced and the divorce proceedings started prior to the tax season of the past due amounts & he filed independent rather than joint. Then maybe you can talk to the judge & a couple things may be able to help you 1)if there is any equity that would be split between both of you then his portion would go directly to the IRS & he would get what's remaining or if there is a balance still owed he will have to pay it 2)ask the judge to have ex contact IRS so they can maybe take off lien & garnish his wages 3)Is the lien against you also or just ex? if you are part of it then call IRS & see what they have to say
In order for you to close on the house you will need a payoff letter from the IRS. The money will be sent directly from the title company to payoff the lien, they will NOT give anyone the money to send to the IRS it must be done directly from the title company so no funny business goes on.
Obviously this is a big problem & unless you or him pay off the lien when the house is sold either with your own money or the equity, then this won't go away. Don't forget you/he can negotiate with the IRS to lower the amount & hopefully that would help some. Good luck