(a) In this section—
(1) “inventory” means personal property leased or furnished, held for sale or lease, or to be furnished under a contract for service, raw materials, work in process, or materials used or consumed in a business, including farm products such as crops or livestock, held for sale or lease;
(2) “new value” means money or money’s worth in goods, services, or new credit, or release by a transferee of property previously transferred to such transferee in a transaction that is neither void nor voidable by the debtor or the trustee under any applicable law, including proceeds of such property, but does not include an obligation substituted for an existing obligation;
(3) “receivable” means right to payment, whether or not such right has been earned by performance; and
(4) a debt for a tax is incurred on the day when such tax is last payable without penalty, including any extension.
(b) Except as provided in subsections (c) and (i) of this section, the trustee may, based on reasonable due diligence in the circumstances of the case and taking into account a party’s known or reasonably knowable affirmative defenses under subsection (c), avoid any transfer of an interest of the debtor in property—
(1) to or for the benefit of a creditor;
(2) for or on account of an antecedent debt owed by the debtor before such transfer was made;
(3) made while the debtor was insolvent;
(A) on or within 90 days before the date of the filing of the petition; or
(B) between ninety days and one year before the date of the filing of the petition, if such creditor at the time of such transfer was an insider; and
(5) that enables such creditor to receive more than such creditor would receive if—
(A) the case were a case under chapter 7 of this title;
(B) the transfer had not been made; and
(C) such creditor received payment of such debt to the extent provided by the provisions of this title.
(c) The trustee may not avoid under this section a transfer—
(1) to the extent that such transfer was—
(A) intended by the debtor and the creditor to or for whose benefit such transfer was made to be a contemporaneous exchange for new value given to the debtor; and
(B) in fact a substantially contemporaneous exchange;
(2) to the extent that such transfer was in payment of a debt incurred by the debtor in the ordinary course of business or financial affairs of the debtor and the transferee, and such transfer was—
(A) made in the ordinary course of business or financial affairs of the debtor and the transferee; or
(B) made according to ordinary business terms;
(3) that creates a security interest in property acquired by the debtor—
(A) to the extent such security interest secures new value that was—
(i) given at or after the signing of a security agreement that contains a description of such property as collateral;
(ii) given by or on behalf of the secured party under such agreement;
(iii) given to enable the debtor to acquire such property; and
(iv) in fact used by the debtor to acquire such property; and
(B) that is perfected on or before 30 days after the debtor receives possession of such property;
(4) to or for the benefit of a creditor, to the extent that, after such transfer, such creditor gave new value to or for the benefit of the debtor—
(A) not secured by an otherwise unavoidable security interest; and
(B) on account of which new value the debtor did not make an otherwise unavoidable transfer to or for the benefit of such creditor;
(5) that creates a perfected security interest in inventory or a receivable or the proceeds of either, except to the extent that the aggregate of all such transfers to the transferee caused a reduction, as of the date of the filing of the petition and to the prejudice of other creditors holding unsecured claims, of any amount by which the debt secured by such security interest exceeded the value of all security interests for such debt on the later of—
(i) with respect to a transfer to which subsection (b)(4)(A) of this section applies, 90 days before the date of the filing of the petition; or
(ii) with respect to a transfer to which subsection (b)(4)(B) of this section applies, one year before the date of the filing of the petition; or
(B) the date on which new value was first given under the security agreement creating such security interest;
(6) that is the fixing of a statutory lien that is not avoidable under section 545 of this title;
(7) to the extent such transfer was a bona fide payment of a debt for a domestic support obligation;
(8) if, in a case filed by an individual debtor whose debts are primarily consumer debts, the aggregate value of all property that constitutes or is affected by such transfer is less than $600; or
(9) if, in a case filed by a debtor whose debts are not primarily consumer debts, the aggregate value of all property that constitutes or is affected by such transfer is less than $6,425.
(d) The trustee may avoid a transfer of an interest in property of the debtor transferred to or for the benefit of a surety to secure reimbursement of such a surety that furnished a bond or other obligation to dissolve a judicial lien that would have been avoidable by the trustee under subsection (b) of this section. The liability of such surety under such bond or obligation shall be discharged to the extent of the value of such property recovered by the trustee or the amount paid to the trustee.
(1) For the purposes of this section—
(A) a transfer of real property other than fixtures, but including the interest of a seller or purchaser under a contract for the sale of real property, is perfected when a bona fide purchaser of such property from the debtor against whom applicable law permits such transfer to be perfected cannot acquire an interest that is superior to the interest of the transferee; and
(B) a transfer of a fixture or property other than real property is perfected when a creditor on a simple contract cannot acquire a judicial lien that is superior to the interest of the transferee.
(2) For the purposes of this section, except as provided in paragraph (3) of this subsection, a transfer is made—
(A) at the time such transfer takes effect between the transferor and the transferee, if such transfer is perfected at, or within 30 days after, such time, except as provided in subsection (c)(3)(B);
(B) at the time such transfer is perfected, if such transfer is perfected after such 30 days; or
(C) immediately before the date of the filing of the petition, if such transfer is not perfected at the later of—
(i) the commencement of the case; or
(ii) 30 days after such transfer takes effect between the transferor and the transferee.
(3) For the purposes of this section, a transfer is not made until the debtor has acquired rights in the property transferred.
(f) For the purposes of this section, the debtor is presumed to have been insolvent on and during the 90 days immediately preceding the date of the filing of the petition.
(g) For the purposes of this section, the trustee has the burden of proving the avoidability of a transfer under subsection (b) of this section, and the creditor or party in interest against whom recovery or avoidance is sought has the burden of proving the nonavoidability of a transfer under subsection (c) of this section.
(h) The trustee may not avoid a transfer if such transfer was made as a part of an alternative repayment schedule between the debtor and any creditor of the debtor created by an approved nonprofit budget and credit counseling agency.
(i) If the trustee avoids under subsection (b) a transfer made between 90 days and 1 year before the date of the filing of the petition, by the debtor to an entity that is not an insider for the benefit of a creditor that is an insider, such transfer shall be considered to be avoided under this section only with respect to the creditor that is an insider.