(a) Judicial proceedings. If the United States is not joined as a party, a judgment in any civil action or suit described in subsection (a) of section 2410 of title 28 of the United States Code, or a judicial sale pursuant to such a judgment, with respect to property on which the United States has or claims a lien under the provisions of this title—
(1) shall be made subject to and without disturbing the lien of the United States, if notice of such lien has been filed in the place provided by law for such filing at the time such action or suit is commenced, or
(2) shall have the same effect with respect to the discharge or divestment of such lien of the United States as may be provided with respect to such matters by the local law of the place where such property is situated, if no notice of such lien has been filed in the place provided by law for such filing at the time such action or suit is commenced or if the law makes no provision for such filing.
If a judicial sale of property pursuant to a judgment in any civil action or suit to which the United States is not a party discharges a lien of the United States arising under the provisions of this title, the United States may claim, with the same priority as its lien had against the property sold, the proceeds (exclusive of costs) of such sale at any time before the distribution of such proceeds is ordered.
(b) Other sales. Notwithstanding subsection (a) sale of property on which the United States has or claims a lien, or a title derived from enforcement of a lien, under the provisions of this title, made pursuant to an instrument creating a lien on such property, pursuant to a confession of judgment on the obligation secured by such an instrument, or pursuant to a nonjudicial sale under a statutory lien on such property—
(1) shall, except as otherwise provided, be made subject to and without disturbing such lien or title, if notice of such lien was filed or such title recorded in the place provided by law for such filing or recording more than 30 days before such sale and the United States is not given notice of such sale in the manner prescribed in subsection (c)(1); or
(2) shall have the same effect with respect to the discharge or divestment of such lien or such title of the United States, as may be provided with respect to such matters by the local law of the place where such property is situated, if—
(A) notice of such lien or such title was not filed or recorded in the place provided by law for such filing more than 30 days before such sale,
(B) the law makes no provision for such filing, or
(C) notice of such sale is given in the manner prescribed in subsection (c)(1).
(c) Special rules.(1) Notice of sale. Notice of a sale to which subsection (b) applies shall be given (in accordance with regulations prescribed by the Secretary) in writing, by registered or certified mail or by personal service, not less than 25 days prior to such sale, to the Secretary.
(2) Consent to sale. Notwithstanding the notice requirement of subsection (b)(2)(C), a sale described in subsection (b) of property shall discharge or divest such property of the lien or title of the United States if the United States consents to the sale of such property free of such lien or title.
(3) Sale of perishable goods. Notwithstanding the notice requirement of subsection (b)(2)(C), a sale described in subsection (b) of property liable to perish or become greatly reduced in price or value by keeping, or which cannot be kept without great expense, shall discharge or divest such property of the lien or title of the United States if notice of such sale is given (in accordance with regulations prescribed by the Secretary) in writing, by registered or certified mail or by personal service, to the Secretary before such sale. The proceeds (exclusive of costs) of such sale shall be held as a fund subject to the liens and claims of the United States, in the same manner and with the same priority as such liens and claims had with respect to the property sold, for not less than 30 days after the date of such sale.
(4) Forfeitures of land sales contracts. For purposes of subsection (b), a sale of property includes any forfeiture of a land sales contract.
(d) Redemption by United States.(1) Right to redeem. In the case of a sale of real property to which subsection (b) applies to satisfy a lien prior to that of the United States, the Secretary may redeem such property within the period of 120 days from the date of such sale or the period allowable for redemption under local law, whichever is longer.
(2) Amount to be paid. In any case in which the United States redeems real property pursuant to paragraph (1), the amount to be paid for such property shall be the amount prescribed by subsection (d) of section 2410 of title 28 of the United States Code.
(3) Certificate of redemption.(A) In general. In any case in which real property is redeemed by the United States pursuant to this subsection, the Secretary shall apply to the officer designated by local law, if any, for the documents necessary to evidence the fact of redemption and to record title to such property in the name of the United States. If no such officer is designated by local law or if such officer fails to issue such documents, the Secretary shall execute a certificate of redemption therefor.
(B) Filing. The Secretary shall, without delay, cause such documents or certificate to be duly recorded in the proper registry of deeds. If the State in which the real property redeemed by the United States is situated has not by law designated an office in which such certificate may be recorded, the Secretary shall file such certificate in the office of the clerk of the United States district court for the judicial district in which such property is situated.
(C) Effect. A certificate of redemption executed by the Secretary shall constitute prima facie evidence of the regularity of such redemption and shall, when recorded, transfer to the United States all the rights, title, and interest in and to such property acquired by the person from whom the United States redeems such property by virtue of the sale of such property.