An IRS lien is paid out of a foreclosure only if it is a valid, properly filed federal tax lien that attaches to the property and survives the foreclosure—and even then, it is paid according to its priority relative to other liens, with junior liens often wiped out rather than paid. The common shorthand “the IRS gets paid in foreclosure” is true only for senior federal tax liens or surplus proceeds after senior claims; a junior IRS lien can be extinguished by a prior mortgage foreclosure, leaving the government to pursue the taxpayer personally. This answer explains the mechanics generally under federal tax-lien law and typical state foreclosure practice; because the query does not specify a state, a property type, or the lien's recording date, the exact outcome in any particular case cannot be determined from the question alone.
The threshold point: a lien is not the same as a levy or a seizure
A federal tax lien arises by operation of law when a taxpayer fails to pay assessed tax after notice and demand. Under Internal Revenue Code §6321, the lien attaches to “all property and rights to property” belonging to the taxpayer. That is a broad, automatic security interest—but it is not the same as a levy, which is an actual seizure of property, or a foreclosure by the government itself. In a private foreclosure, the IRS is usually a passive lienholder whose interest is addressed by the foreclosure's priority rules. The IRS can also administratively levy on a taxpayer's property, and it can seek to reduce its lien to judgment or foreclose its own lien, but those are separate proceedings from a mortgage foreclosure.
This distinction matters because people often conflate three questions: Does the IRS have a claim on the property? Will the IRS actually receive money from this foreclosure sale? Can the IRS still collect from the taxpayer afterward? The answers can differ.
Priority governs everything
The core rule is “first in time, first in right” among competing interests, subject to statutory exceptions. A federal tax lien's priority is generally measured from the date the IRS files a notice of federal tax lien (NFTL) in the appropriate recording office, not from the date the tax was assessed. Against other lienholders, the earlier-perfected interest generally prevails. Against a later mortgage, a properly filed federal tax lien is senior; against an earlier mortgage, it is junior.
| Lien position | Effect in a typical foreclosure sale |
|---|---|
| IRS lien senior to the foreclosing mortgage | Generally must be satisfied from sale proceeds before the foreclosing lender; may require the IRS to be joined or the sale to account for it |
| IRS lien junior to the foreclosing mortgage | Generally extinguished by the foreclosure if the IRS is properly joined, with the IRS paid only from surplus after senior claims |
| No NFTL filed, or lien otherwise not valid against the purchaser | May not attach to the property as against a subsequent purchaser in some circumstances |
That table is a simplification. The actual result depends on state recording law, the type of interest, whether the foreclosure is judicial or nonjudicial, and whether the IRS was properly named and served. A key federal wrinkle: the Federal Tax Lien Act of 1966 and later amendments created protections for certain purchasers, mechanics lienors, and holders of security interests, so “first in time” is not applied mechanically in every contest.
The critical practical issue: joining the IRS
In a judicial foreclosure, the foreclosing party typically must name all parties with an interest in the property, including the United States if it holds a federal tax lien, and serve them according to the applicable rules. If a junior federal tax lien is not properly joined, the foreclosure may not extinguish it, and the IRS's lien can survive the sale—a nasty surprise for a buyer. Courts have generally required strict compliance with the procedures for naming and serving the United States; the details vary by jurisdiction and by the nature of the lien.
In a nonjudicial foreclosure (common with deeds of trust in many states), there is no court case in which to name defendants. Instead, state statutes prescribe notice requirements, and the deed of trust's power of sale is exercised according to the instrument and statute. Whether a junior federal tax lien is extinguished by a nonjudicial sale depends on federal law and the adequacy of notice. Federal law provides that a nonjudicial sale of property can discharge a federal tax lien if notice of sale is given to the IRS in the manner and time required—generally at least 25 days before the sale—so a failure to give proper notice can leave the lien in place. This is a technical area where practitioners routinely check the notice rules.
A common misconception follows from this: people assume that because the mortgage is “first,” the IRS lien simply vanishes in every foreclosure. It may be extinguished, but only if the foreclosure is effective against it—meaning proper parties and proper notice. If it is extinguished, the IRS's claim against the property is gone, but the underlying tax debt remains the taxpayer's personal liability.
When the IRS actually gets paid from the sale
There are three main scenarios in which the IRS receives money from a foreclosure sale:
1: The federal tax lien is senior to the foreclosing lien. The IRS is paid from proceeds before the foreclosing lender (subject to any liens senior to the IRS). This is less common than people imagine, because mortgage liens often predate the tax lien. 2: The IRS lien is junior, but there is a surplus after paying senior liens. If sale proceeds exceed the senior debt and costs, junior lienholders—including the IRS—may claim from the surplus in priority order. Whether the IRS must be paid from surplus, and how surplus is distributed, is governed by state law and the foreclosure judgment. 3: The IRS redeems the property. Federal law gives the United States a right of redemption in certain circumstances after a sale that divests a federal tax lien—generally within 120 days—by paying the purchaser the sale price plus interest and certain costs. This is a real but relatively uncommon outcome; it is not the everyday “IRS gets paid” scenario, but it can affect a buyer's expectations.
Outside those situations, a junior federal tax lien that is extinguished by foreclosure yields the IRS nothing from the sale. The taxpayer still owes the tax, and the IRS retains its collection tools—levy, garnishment, and suit—against the taxpayer's other assets, subject to statutes of limitations and collection due process protections.
What “paid for in the foreclosure process” can mean
The phrase is ambiguous and worth separating:
Paid from sale proceeds at closing: only if senior or paid from surplus as above. Paid by the buyer separately: generally not; a buyer at foreclosure takes subject to liens that survive, and title companies typically require resolution of surviving federal liens before insuring title. Paid by the foreclosing lender to clear title: sometimes a lender will pay off a junior tax lien to deliver clear title, but that is a business decision, not a legal entitlement. Paid by the taxpayer later: the debt survives personally even when the lien is extinguished, so “paid” may simply mean “still owed.”
This distinction explains a frequent confusion in real-estate transactions: a buyer may be told the IRS lien was “wiped out” by foreclosure, which is true as to the property but false as to the taxpayer's obligation. The government's claim against the person does not disappear because its security interest in one parcel did.
How the amount is determined
The IRS's secured claim is generally the unpaid tax, plus penalties and interest, plus certain costs, up to the value of its interest in the property. The lien attaches to the taxpayer's equity, not to the full fair market value if senior liens consume it. In practice, if a senior mortgage exceeds the sale price, a junior IRS lien has nothing to attach to economically—even if it is technically valid—so the IRS receives nothing and the lien may be extinguished without payment. This is why “the IRS has a lien” does not mean “the IRS will be paid.”
State variation and the missing facts
Because the question does not identify a state, a property type, the recording dates, or whether the foreclosure is judicial or nonjudicial, no single outcome can be stated. State law controls the foreclosure procedure, the treatment of surplus, and the mechanics of notice; federal law controls the lien's validity, priority, and the effect of the sale on the federal interest. A few stable points hold across jurisdictions: a validly filed federal tax lien has priority from its filing date against later interests; a properly conducted foreclosure can extinguish a junior federal tax lien; failure to give the United States required notice can preserve the lien; and the taxpayer's personal liability persists regardless.
A concrete illustration
Suppose a homeowner has a first mortgage recorded in 2015, an IRS notice of federal tax lien filed in 2019, and a home equity line recorded in 2021. The first mortgage forecloses. The IRS lien is junior to the first mortgage but senior to the HELOC. If the sale yields enough to pay the first mortgage and costs but not the IRS, the IRS typically receives nothing, and its lien is extinguished if the foreclosure properly joined or noticed the United States. The HELOC is also junior and typically gets nothing. The homeowner still owes the back taxes. If, instead, the sale yields a surplus, the IRS is paid from that surplus ahead of the HELOC. If the IRS lien had been filed in 2014, before the first mortgage, the IRS would generally be paid before the foreclosing lender, which changes the lender's economics and often its willingness to foreclose.
Common errors to avoid
Assuming the IRS is always paid: it is paid only according to priority and available proceeds. Assuming the lien always survives: a properly conducted foreclosure can extinguish a junior federal tax lien. Assuming extinguishment cancels the debt: it does not; personal liability remains. Ignoring notice requirements: failure to serve or notify the United States can leave the lien in place and cloud title. Treating the NFTL date as irrelevant: for priority against later interests, it is usually the key date.
Frequently asked questions
Does the IRS have to be paid before the mortgage in a foreclosure? Only if the federal tax lien is senior to that mortgage—generally because it was filed earlier—or if the mortgage is otherwise subordinate. A later-filed IRS lien is junior and is paid after the senior mortgage, often receiving nothing.
Can a foreclosure wipe out an IRS lien? Yes, a junior federal tax lien can be extinguished by a foreclosure that is effective against it, including proper notice to the United States. The tax debt itself is not wiped out.
What happens to surplus proceeds? They are distributed under state law in priority order; the IRS may claim as a junior lienholder, and its claim is generally limited to its interest.
Can the IRS stop a foreclosure? The IRS can redeem in certain circumstances and can pursue its own collection, but it generally does not have a veto over a private foreclosure; its leverage is its lien priority and redemption right.
Does the buyer at foreclosure owe the IRS? Generally no, if the lien is extinguished by the sale; but a buyer takes subject to liens that survive, so title review and proper notice matter enormously.
Is the answer different for a tax sale by a local government? Yes. Property-tax foreclosure and tax-sale procedures differ from mortgage foreclosure, and the interaction with federal tax liens has its own rules, including notice and redemption provisions. The question's reference to “the foreclosure process” most naturally points to mortgage foreclosure, but the distinction is worth flagging.
Bottom line
An IRS lien is paid in foreclosure when it is senior or when surplus proceeds reach it after senior claims; a junior federal tax lien is often extinguished without payment, while the taxpayer's personal tax debt continues. The outcome hinges on filing dates, the foreclosing lien's priority, whether the United States was properly joined or noticed, and state foreclosure law—facts the question does not supply. Anyone facing an actual foreclosure with a federal tax lien should confirm the lien's filing date, the foreclosure type, and the notice served on the IRS, because those details decide whether the lien is paid, extinguished, or survives.