
248 B.R. 794 (2000)
In re DAVICTER ENTERPRISES, INC., Debtor.
No. 99-41651.
United States Bankruptcy Court, S.D. Illinois.
May 18, 2000.
*795 T. David Purcell, Mitchell, Neubauer & Hanson, P.C., Mt. Vernon, for Plaintiff or Petitioner.
Michelle Vieira, Chapter 7 Trustee, Carbondale, for Defendants or Respondent.
Terry Sharp, Mt. Vernon, for Debtors.

OPINION
KENNETH J. MEYERS, Bankruptcy Judge.
In this action, Floyde Black Construction Co. ("Black") seeks to set off the amount of its liability for mechanics' lien claims filed by material suppliers for the debtor against the amount Black owes the debtor on its subcontract with Black. Black asserts that, as general contractor on the project in question, it is liable to suppliers who furnished materials for performance of the debtor's subcontract but who were not paid. Black maintains that it should be allowed to set off the amount of its liability to the material suppliers from the amount it owes the debtor in order to avoid double payment.
The Chapter 7 trustee objects to Black's petition for setoff, arguing that Black's liability on the lien claims of the debtor's material suppliers did not arise until such suppliers filed their mechanics' lien notices against both the debtor and Black after the debtor's bankruptcy filing. Thus, the trustee contends, Black's obligation to the suppliers arose postpetition and cannot be set off against Black's obligation to the debtor, which arose under the debtor's prepetition contract.
The facts are not in dispute. On September 8, 1999, the debtor, Davicter Enterprises, Inc., filed for Chapter 7 bankruptcy relief. Prior to filing, in April 1999, the debtor began work as a subcontractor for Black providing mechanical and electrical services on a school construction project in Wayne City, Illinois. Black advanced funds to the debtor for supplies used on the project, but the debtor failed to pay the material suppliers. The debtor, *796 moreover, discontinued work before completing its subcontract, and Black was forced to incur additional expense to finish the work.
Following the debtor's bankruptcy filing, the debtor's material suppliers filed mechanics' lien notices under section 23 of the Illinois Mechanics' Lien Act, see 770 Ill. Comp. Stat. 60/23, to obtain liens against funds allocated for the school project.[1] As a result, the school district withheld funds sufficient to pay the claims of the material suppliers from the amounts due Black on its contract.
Black now seeks to set off the amount of its liability on the lien claims of the material suppliers against the amount it owes the debtor for work performed under the contract. The amount of the lien claims filed by the debtor's material suppliers totals $16,110.77. In addition, Black asserts that it expended over $14,000 to finish the subcontract after the debtor's breach. Black maintains that it is entitled to set off both amounts against the amount it owes the debtor of approximately $28,000.[2]
The trustee argues that Black is not entitled to set off the amount of the mechanics' lien claims because its liability did not arise until after the debtor's bankruptcy filing when the lien notices were filed. The trustee contends that until such notices were filed, the debtor, and not Black, was solely responsible to satisfy the unpaid claims of the material suppliers. According to the trustee, in order to have a right of setoff against the debtor, Black would have had to pay the suppliers' claims prior to bankruptcy so as step into their shoes as subrogee and thus have a prepetition claim against the debtor.
Section 553 of the Bankruptcy Code recognizes and preserves a creditor's right of setoff in bankruptcy, stating:
(a) Except as otherwise provided . . ., this title [Title 11] does not effect 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 . . . against a claim of such creditor against the debtor that arose before the commencement of the case. . . .
11 U.S.C. § 553(a) (emphasis added). While this section sanctions the use of setoff in bankruptcy, it prescribes certain conditions that must be satisfied before the right is available. In particular, both the creditor's "claim" against the debtor and its "debt" to the debtor must have arisen before commencement of the debtor's case,[3] and the obligations must be "mutual" as existing between the same parties acting in the same capacity. By requiring that both parties' obligations arise before the commencement of the case, § 553(a) precludes the setoff of postpetition obligations against prepetition claims or debts. See 3 Norton Bankr.L. & Prac.2d, § 63:3, at 63-19, § 63:4, at 63-21 to 63-22 (1997).
Case law establishes that a party who pays a debt for which the debtor is primarily liable may acquire a claim against the debtor, and a corresponding right of setoff, under the equitable doctrine of subrogation. In re J.A. Clark Mechanical, Inc., 80 B.R. 430, 432 (Bankr. N.D.Ohio 1987); In re Flanagan Bros., Inc., 47 B.R. 299, 301 (Bankr.D.N.J.1985); see Matter of Bel Marin Driwall, Inc. v. *797 Grover, 470 F.2d 932 (9th Cir.1972). The party who pays such debt is entitled to step into the creditor's shoes and assert its claim by way of setoff in order to recover the payments made. See 4 Collier on Bankruptcy, ¶ 553.03[3][h][ii], at 553-51 (15th ed. rev.2000). Section 553(a), however, prohibits the setoff of a claim acquired by subrogation  by payment of the debtor's debt to a third party  if such payment occurred after the debtor's bankruptcy. Under § 553(a)(2)(A), setoff of a creditor's claim against the debtor is not permitted if
such claim was transferred, by an entity other than the debtor, to such creditor 
(A) after the commencement of the case[.]
11 U.S.C. § 553(a)(2)(A).
This provision, like other restrictions regarding the setoff of pre-bankruptcy claims or debts,[4] was intended to prevent creditors from trafficking in claims against the debtor to effect a setoff. See 3 Norton Bankr.L. & Prac.2d, § 63:9, at 63-40; Flanagan Bros., 47 B.R. at 303. In the absence of such restrictions, those indebted to the debtor would have an incentive to purchase claims against the debtor from third-party creditors, most likely at a discount, in order to reduce their indebtedness through exercise of the acquired setoff rights. See 4 Collier on Bankruptcy, ¶ 553.03[5][a][i], at 553-54. Allowing a creditor to create a setoff in this manner would contravene the equitable purposes underlying setoff and create an unfair advantage at the expense of other creditors.[5]See id.; Flanagan.
Notwithstanding the prohibition regarding claims acquired postpetition, an exception has been recognized when the party seeking to exercise setoff had an independent legal obligation to a third-party creditor that existed prepetition. This exception, although developed under pre-Code case law, remains viable following enactment of § 553. See Sherman v. First City Bank of Dallas, 99 B.R. 333, 336 (N.D.Tex.1989); Flanagan, 47 B.R. at 303. Thus, in Flanagan, the court found that a general contractor, who under state law was liable as a surety for suppliers furnishing materials to the debtor-subcontractor, was entitled to a set off in the event the general contractor paid the debtor's supplier, even though such payment would occur after the debtor's bankruptcy. 47 B.R. at 303. The court reasoned that the general contractor was liable directly to the supplier as surety for the debtor's obligations on the project, as well as being indirectly liable to the supplier because of its indebtedness to the debtor. If the debtor's estate were insufficient to pay the supplier's unsecured claim, the contractor would have paid the supplier twice, once directly as the debtor's surety on the project and again by reason of its payment to the estate representing a satisfaction of the contractor's indirect liability to the supplier.
The Flanagan court determined that this result was contrary to Congressional intent, despite the language of § 553(a)(2)(A) barring setoff of a claim transferred postpetition, and held that "a claim is not transferred within the meaning of § 553(a)(2)(A) `when the claim used as a set-off has been acquired as a result of a direct legal obligation.'" Id. (quoting Bel Marin Driwall, 470 F.2d at 936). Because, in Flanagan, the liability of the general contractor, as surety, to pay the supplier's claim existed prepetition, the contractor's setoff once it paid the supplier *798 following bankruptcy did not violate § 553(a)(2)(A).
Similarly, in Bel Marin, a general contractor who was notified prior to bankruptcy of a claim by a supplier of the debtor-subcontractor,[6] and who paid this claim following the debtor's bankruptcy, was entitled to set off the amount of the supplier's claim against the general contractor's liability to the debtor for work performed. The Bel Marin court noted that the issue was "not when [the] offsetting payment was made, but whether an offsetting liability existed[.]" 470 F.2d at 935, and ruled that setoff was proper where the contractor had a direct obligation to the supplier, independent of the debtor's obligation as subcontractor, that existed prepetition. Id. To the extent this obligation existed, the purpose of the contractor's payment was to discharge his statutory duty, "not to acquire a setoff in bankruptcy so as to gain a full rather than a discounted payment of the claim."[7] 470 F.2d at 936.
In the present case, Black had not paid the claims of the debtor's material suppliers at the time the debtor filed for bankruptcy relief, and any payment by reason of the mechanics' lien notices would necessarily occur after commencement of the debtor's case. In addition, unlike in Flanagan, where the general contractor's liability, as surety, to pay the supplier's claim existed prior to bankruptcy pursuant to state law, and Bel Marin, where the general contractor was notified prior to bankruptcy of the supplier's claim against him, the suppliers in this case had not filed their mechanics' lien notices at the time of bankruptcy, and it was not readily apparent that Black was liable for payment of their claims. However, to the extent that Black, under relevant law governing mechanics' liens in Illinois, became liable for payment of the suppliers' claims prior to the debtor's bankruptcy, Black would, like the general contractors in Flanagan and Bel Marin, have an independent obligation to the suppliers entitling it to a setoff against the amount owed to the debtor.
Section 23 of the Illinois Mechanics Lien Act, applicable in this case, provides that anyone furnishing materials or labor to a contractor "having a contract for public improvement" with a school district in Illinois "shall have a lien for the value thereof on the money . . . due or to become due the contractor . . . under such contract[.]"[8] 770 Ill. Comp. Stat. 60/23(b). As a condition of this lien, the material supplier must, before payment is made to the contractor, file notice of its claim with the appropriate school official and furnish a copy of the notice to the contractor. Id. Such notice perfects the supplier's lien in the funds due the contractor, and the supplier *799 must then file suit to enforce the lien within 90 days.[9]Id.
While § 23 prescribes the procedural requisites to perfect a lien on public funds, the supplier's right to acquire a lien on the funds arises upon the furnishing of materials or labor on the public project. Under Illinois case law, this right is described as an "inchoate" or incipient lien, which may be lost upon failure to provide notice as prescribed by statute. See Pittsburgh Plate Glass Co. v. Kransz, 291 Ill. 84, 125 N.E. 730, 732 (1919). However, once the lien is properly perfected by notice, the lien attaches to the property in question and "relates back" to the date the inchoate lien arose. See In re Petroleum Piping Contractors, Inc., 211 B.R. 290, 302 (Bankr.N.D.Ind.1997) (construing Illinois mechanics' lien statute); In re Saberman, 3 B.R. 316, 318 (Bankr.N.D.Ill.1980); 26 I.L.P. Mechanics' Liens, § 81, at 324. Thus, the lien exists from the date of the parties' contract, although notice of the claim of lien must be given to preserve and enforce it. Pittsburgh Plate Glass Co., 125 N.E. at 732; see Petroline Co. v. Advanced Environmental Contractors, Inc., 305 Ill. App.3d 234, 238 Ill.Dec. 485, 711 N.E.2d 1146, 1149 (1999).
In the present case, it is undisputed that the debtor's material suppliers performed their contract with the debtor to furnish materials prior to the debtor's bankruptcy. Under Illinois law, they became entitled to acquire a lien against the public funds due Black on its contract at that time, and this right became fixed and enforceable through the filing of their lien notices. Although the filing of such notices occurred following bankruptcy, the suppliers' lien rights "related back" to the date of their contract to furnish materials, which was prior to bankruptcy. Thus, at the time the debtor filed its bankruptcy petition, Black, as general contractor, had a direct liability to these suppliers that was independent of its obligation to the debtor. For this reason, any payment to the suppliers from the funds held by the school district would satisfy the suppliers' claims against the debtor and entitle Black to a claim that may be offset against the amount owing to the debtor in this bankruptcy proceeding.
For the reasons stated, the Court finds that Black's petition for setoff under § 553(a) should be granted. The trustee's objection to setoff, accordingly, will be overruled.
SEE WRITTEN ORDER.
NOTES
[1]  Under the Illinois public mechanics' lien statute, a person furnishing materials or labor on a public works project may, upon proper notice, obtain a lien for the value thereof "on the money . . . due or to become due the contractor having a contract with [the public body in question]." 770 Ill. Comp. Stat. 60/23(b) (1993).
[2]  The trustee, while acknowledging that Black is entitled to set off the costs incurred to complete the debtor's contract, disputes the $14,000 figure alleged by Black. By agreement of the parties, this amount will be determined at a later time.
[3]  Under the Code, the concepts of "claim" and "debt" are coextensive, with "claim" defined as "right to payment" and "debt" defined as "liability on a claim." See 11 U.S.C. §§ 101(5), 101(12).
[4]  Section 553(a)(2)(B) proscribes setoff if the relevant claim was acquired from another creditor within 90 days before commencement of the case, while § 553(a)(3) prohibits a creditor from incurring a debt within 90 days of bankruptcy for the purpose of obtaining a right of setoff against the debtor. See 11 U.S.C. § 553(a)(2)(B), § 553(a)(3).
[5]  Setoff in the bankruptcy context avoids the potential injustice of requiring a creditor to pay the full amount owed to the debtor while receiving only a partial dividend on his claim against the debtor. See In re Marshall, 240 B.R. 302, 304 (Bankr.S.D.Ill.1999).
[6]  Under California law at issue in Bel Marin, such notice temporarily perfected the supplier's rights against the general contractor. See 470 F.2d at 935. The supplier had only to commence timely suit against the contractor to recover judgment for payment of its claim, as the general contractor had a mandatory obligation to ensure payment of materialmen and suppliers. Id.
[7]  Bel Marin was decided under § 68b(2) of the former Bankruptcy Act, 11 U.S.C. § 108b(2) (1964), which expressly forbade the setoff of a claim acquired after bankruptcy "with a view to such use [as a setoff]" and with knowledge of the debtor's insolvency. See 470 F.2d at 935. This provision gave rise to the rule that setoff of a claim acquired postpetition would not be allowed where payment was voluntary and without legal compulsion. See Tucson House Constr. Co., v. Fulford, 378 F.2d 734, 736-38 (9th Cir.1967). The corollary, that setoff should be allowed if the claim was acquired as the result of a direct or independent legal obligation, is the basis of the exception applied here. See also In re Scherer Hardware and Supply, Inc., 9 B.R. 125, 129 (Bankr.N.D.Ill.1981).
[8]  The statute specifies that the term "contractor" includes any "subcontractor." See 770 Ill. Comp. Stat. 60/23(a). Thus, the statute protects not only a subcontractor dealing directly with the general contractor, but also one furnishing materials or labor to such subcontractor, and a supplier may, therefore, acquire a lien under this provision. See Koenig v. McCarthy Constr. Co., 344 Ill.App. 93, 100 N.E.2d 338, 341 (1951); 26 I.L.P. Mechanics' Liens, § 72, at 322 (1956).
[9]  Failure to file an action as specified in the statute results in termination of the lien. 770 Ill. Comp. Stat. 60/23(b). In this case, the time for filing such suit has been tolled pursuant to § 108(c) of the Bankruptcy Code, see 11 U.S.C. § 108(c), as the suppliers were stayed from naming the debtor as defendant in an action to enforce the lien. See Garbe Iron Works, Inc. v. Priester, 99 Ill.2d 84, 75 Ill.Dec. 428, 457 N.E.2d 422, 424 (1983).
