6416(b)(5)), but instead— (A) there shall be paid an amount equal to the difference between— (i) the tax previously paid on the payments on such installment accounts, and (ii) the total tax which would be payable if such installment accounts had not been sold or otherwise disposed of (computed as provided in paragraph (1)), except that (B) if any such sale is pursuant to the order of, or subject to the approval of, a court of competent jurisdiction in a bankruptcy or insolvency proceeding, the amount computed under subparagraph (A) shall not exceed the sum of the amounts computed by multiplying— (i) the proportionate share of the amount for which such accounts are sold which is allocable to each unpaid installment payment, by (ii) the rate of tax under this chapter in effect on the date such unpaid installment payment is or was due. The sum of the amounts payable under this subsection in respect of the sale of any article shall not exceed the total tax. 5904. Exemption from tax (a) In general Marijuana products on which the internal revenue tax has not been paid or determined may, subject to such regulations as the Secretary shall prescribe, be withdrawn from the bonded premises of any producer in approved containers free of tax and not for resale for use— (1) exclusively in scientific research by a laboratory, (2) by a proprietor of a marijuana production facility in research, development, or testing (other than consumer testing or other market analysis) of processes, systems, materials, or equipment, relating to marijuana or marijuana operations, under such limitations and conditions as to quantities, use, and accountability as the Secretary may by regulations require for the protection of the revenue, or (3) by the United States or any governmental agency thereof, any State, any political subdivision of a State, or the District of Columbia, for nonconsumption purposes. (b) Marijuana products transferred or removed in bond from domestic factories and export warehouses (1) In general Subject to such regulations