§ 553. Setoff

(a) Except as otherwise provided in this section and in sections 362 and 363 of this title, this title does not affect any right of a creditor to offset a mutual debt owing by such creditor to the debtor that arose before the commencement of the case under this title against a claim of such creditor against the debtor that arose before the commencement of the case, except to the extent that—
(1) the claim of such creditor against the debtor is disallowed;
(2) such claim was transferred, by an entity other than the debtor, to such creditor—
(A) after the commencement of the case; or
(B)
(i) after 90 days before the date of the filing of the petition; and
(ii) while the debtor was insolvent (except for a setoff of a kind described in section 362 (b)(6), 362 (b)(7), 362 (b)(17), 362 (b)(27), 555, 556, 559, 560, or 561); or
(3) the debt owed to the debtor by such creditor was incurred by such creditor—
(A) after 90 days before the date of the filing of the petition;
(B) while the debtor was insolvent; and
(C) for the purpose of obtaining a right of setoff against the debtor (except for a setoff of a kind described in section 362 (b)(6), 362 (b)(7), 362 (b)(17), 362 (b)(27), 555, 556, 559, 560, or 561).
(b)
(1) Except with respect to a setoff of a kind described in section 362 (b)(6), 362 (b)(7), 362 (b)(17), 362 (b)(27), 555, 556, 559, 560, 561, 365 (h), 546 (h), or 365 (i)(2) of this title, if a creditor offsets a mutual debt owing to the debtor against a claim against the debtor on or within 90 days before the date of the filing of the petition, then the trustee may recover from such creditor the amount so offset to the extent that any insufficiency on the date of such setoff is less than the insufficiency on the later of—
(A) 90 days before the date of the filing of the petition; and
(B) the first date during the 90 days immediately preceding the date of the filing of the petition on which there is an insufficiency.
(2) In this subsection, “insufficiency” means amount, if any, by which a claim against the debtor exceeds a mutual debt owing to the debtor by the holder of such claim.
(c) 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.