OPINION
R. GUY COLE, JR., Circuit Judge.Approximately six months before he filed a voluntary Chapter 7 bankruptcy petition, David Scott Lee (“Lee” or “Debt- or”) refinanced a residential mortgage loan with Chase Manhattan Mortgage Corporation (“Chase”), which was both the holder of the original mortgage and the refinanced mortgage. Seventy-seven days before Lee filed his bankruptcy case, and seventy-two days after Chase had distributed the funds that were used to discharge the original mortgage, a new mortgage on *461his residential real estate was recorded in favor of Chase to secure Lee’s obligation to repay the new loan. At issue in this appeal is whether Chase’s new mortgage lien may be avoided as a preferential transfer under 11 U.S.C. § 547. For the reasons below, we hold that the earmarking doctrine does not provide a refuge for late-perfecting secured creditors and thus does not shield Chase from preference exposure. We also reject Chase’s contention that perfection of its mortgage during the 90-day preference period did not result in diminution of Lee’s bankruptcy estate. Accordingly, we REVERSE the order of the district court and reinstate the bankruptcy court’s judgment in favor of the Trustee.
I. BACKGROUND
A. Facts
In early 2001, the Debtor purchased the premises located at 129 West New York Avenue, Pontiac, Michigan (“Property”) and obtained a thirty-year mortgage loan in the principal amount of $108,000 from Flagstar Bank, FSB (“Flagstar”). The Debtor executed and delivered to Flagstar a promissory note (“Promissory Note”) that was secured by a mortgage on the Property (“Original Mortgage”). The Original Mortgage was properly recorded by the Clerk/Register of Deeds of Oakland County, Michigan (“Register of Deeds”).
Later in 2001, Flagstar assigned the Promissory Note and the Original Mortgage to the Federal National Mortgage Association, in care of Chase Mortgage Company, an Ohio Corporation (“Chase Ohio”), pursuant to an Assignment of Mortgage that was recorded by the Register of Deeds in early 2002. By merger of Chase Ohio into Chase, Chase became the holder of both the Original Mortgage and the loan evidenced by the Promissory Note (“Original Loan”).
On October 6, 2003, the Debtor refinanced the Original Loan. The Debtor obtained another mortgage loan (“New Loan”) from Chase, and used the proceeds to pay off the Original Loan. The Debtor also granted Chase a new 30-year mortgage (“New Mortgage”). By a “Discharge of Mortgage” dated October 27, 2003 (“Discharge”), Chase discharged the Original Mortgage. The Discharge stated that the Original Mortgage was “fully paid, satisfied and discharged.” The Register of Deeds received the Discharge on November 12, 2003 and recorded it on January 16, 2004. On December 17, 2003 — 51 days after Chase discharged the Original Mortgage and 72 days after the closing of the New Loan — the Register of Deeds recorded the New Mortgage.
B. Procedural History
On March 4, 2004, 77 days after the New Mortgage was recorded, the Debtor commenced his bankruptcy case by filing a voluntary petition for relief under Chapter 7 of the Bankruptcy Code in the United States Bankruptcy Court, Eastern District of Michigan. On April 20, 2004, the Chapter 7 Trustee Mark H. Shapiro (“Trustee”) filed an adversary complaint in the bankruptcy court against Chase, seeking to avoid the New Mortgage as a preferential transfer under 11 U.S.C. § 547(b). On April 6, 2005, the Trustee filed a Motion for Summary Judgment in the adversary proceeding, arguing that he had met all elements of § 547(b) and that the New Mortgage should be avoided. On April 21, 2005, Chase filed a Response to the Trustee’s Motion for Summary Judgment and a Cross-Motion for Summary Judgment, asserting the earmarking doctrine as a defense to the Trustee’s § 547(b) preference claim. On May 6, 2005, the Trustee filed a Response to Chase’s Cross-Motion for Summary Judgment. Chase, on May 20, *4622005, filed a Reply to the Trustee’s Response and argued that, in addition to the earmarking doctrine, the Trustee had not met all elements of § 547(b) because the Trustee had failed to prove that the New Mortgage caused diminution of the estate’s assets under § 547(b)(5), where diminution in this case would be a showing that Chase’s perfection of the New Mortgage resulted in a diminished estate from which the Debtor’s other creditors could recover.
1. Bankruptcy Court Decision
The bankruptcy court avoided the New Mortgage as a preferential transfer because it found that the Trustee had met its burden on all elements under § 547(b) and found that the earmarking doctrine did not apply. See Shapiro v. Chase Manhattan Mortgage Corp. (In re Lee), 326 B.R. 704 (Bankr.E.D.Mich.2005), rev’d, 339 B.R. 165 (E.D.Mich.2006). The bankruptcy court reasoned that because the New Mortgage was not recorded and perfected for more than two months after the initial transaction, the perfection did not relate back to the initial transfer pursuant to § 547(e)(2)(B). The court rejected Chase’s earmarking argument, finding that there were two transfers in this case: the October 6 transfer of funds from Chase to the debtor to release the Original Mortgage and the transfer perfecting the security interest through the recording of the New Mortgage on December 17. The court held that the earmarking doctrine protected only the first transfer.
The court next rejected Chase’s argument that there was no diminution of the Debtor-estate’s assets, finding that because Chase delayed in perfecting its mortgage lien, the Court could not treat the October 6 refinancing as part of the same transaction as the transfer of the lien recorded on December 17. Because the two transactions were separate transactions, the diminution requirement was met because perfection of the New Mortgage elevated Chase from unsecured to secured status, resulting in fewer assets of the Debtor’s estate for other unsecured creditors. The court granted the Trustee’s motion for summary judgment, holding that the estate was diminished by the December 17 perfection of the New Mortgage, and that the secured interest was an avoidable preference.
2. District Court Decision
On appeal, the district court found that the Trustee did not establish diminution as required by § 547(b). See Shapiro v. Chase Manhattan Mortgage Corp. (In re Lee), 339 B.R. 165 (E.D.Mich.2006). The court explained that, treating the entire refinancing process as a whole, the value of the estate did not decrease. That is, before the whole transaction, the Debtor’s Property was secured by a mortgage and the Debtor had to make minimum monthly payments of $942.16, and following the whole transaction, the Debtor’s Property was still secured by a mortgage and the Debtor had to make minimum monthly payments of $567.31. Thus, the district court concluded, the estate’s assets arguably increased because the monthly payments and interest rate decreased following the New Loan. The court next treated the refinancing transaction as a whole and determined that the earmarking doctrine protected Chase even if the Trustee had met all of § 547(b)’s requirements.
The district court’s rationale for treating the entirety of the refinancing as one transaction was that even though the recorded interest occurred outside the 10-day period of § 547(e), “[t]he granting of the loan and recording the mortgage are two sides of the same coin, they are one transaction. To view it any other way would be to elevate form over substance.” *463In reaching this conclusion, the district court cited Kaler v. Community First National Bank (In re Heitkamp), 137 F.3d 1087, 1089 (8th Cir.1998), which relied solely on the earmarking doctrine when upholding a bank’s security interest that was perfected outside the 10-day period in § 547(e) and within the 90-day period before the debtor filed for Chapter 7 bankruptcy.
The Trustee filed a timely Notice of Appeal on April 4, 2006.
II. LEGAL ANALYSIS
When reviewing an order of a bankruptcy court on appeal from a decision of a district court, we review the bankruptcy court’s order directly and give no deference to the district court’s decision. See Rogan v. Bank One, Nat'l Ass’n (In re Cook), 457 F.3d 561, 565 (6th Cir.2006). We review the bankruptcy court’s findings of fact under the clearly erroneous standard, asking only whether we are left with a definite and firm conviction that a mistake has been committed. We review conclusions of law made by the bankruptcy court de novo. See id.
A. Preferential Transfers — General Principles
Under § 547 of the Bankruptcy Code, a trustee may avoid certain transfers made to creditors within 90 days prior to the commencement of the bankruptcy case.1 The section serves two purposes. First, it fosters equality of distribution among creditors, which is one of the primary goals of the Bankruptcy Code. See Begier v. IRS., 496 U.S. 53, 58, 110 S.Ct. 2258, 110 L.Ed.2d 46 (1990) (“Equality of distribution among creditors is a central policy of the Bankruptcy Code ... Section 547(b) furthers this policy by permitting a trustee in bankruptcy to avoid certain preferential payments made before the debtor files for bankruptcy.”). Second, it “discourages ‘secret liens’ upon the debt- or’s collateral which are not perfected until just before the debtor files for bankruptcy.” Grover v. Gulino (In re Gulino), 779 F.2d 546, 549 (9th Cir.1985). See also Ray v. Sec. Mut. Fin. Corp. (In re Arnett), 731 F.2d 358, 363 (6th Cir.1984) (“One of the principal purposes of the Bankruptcy Reform Act is to discourage the creation of “secret liens.”).
1. Section 517(b)
The elements of a preferential transfer are set forth in § 547(b), which states:
(b) Except as provided in subsection (c) of this section, the trustee may 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;
(4) made—
(A) on or within 90 days before 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;
*464(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.
11 U.S.C. § 547(b) (2004).
Two elements of § 547(b) are at issue in this appeal. The first is the requirement imposed by the prefatory language “any transfer of an interest of the debtor in property,” where “ ‘property of the debtor’ ... is best understood as that property that would have been part of the estate had it not been transferred before the commencement of bankruptcy proceedings.” Begier, 496 U.S. at 58, 110 S.Ct. 2258. The second element at issue is the “diminution-of-the-estate” requirement. Although § 547(b) does not expressly make diminution of the estate an element of a preference claim, diminution is understood to be a requirement as a result of § 547(b)(5)’s improvement-in-position test: “The concept here is the same as the idea developed in old Supreme Court opinions under old bankruptcy acts — that a voidable preference must ‘impair,’ or ‘diminish,’ the estate.” Waldschmidt v. Mid-State Homes, Inc. (In re Pitman), 843 F.2d 235, 241 (6th Cir.1988) (citations omitted); see also Mandross v. Peoples Banking Co. (In re Hartley), 825 F.2d 1067, 1071 (6th Cir.1987) (“Even where the debtor transfers a security interest in return for the loan, the payment is only a voidable preference to the extent the transaction depleted the debtor’s estate.”).
2. Section 51.7(e)
The other provision of the Bankruptcy Code before us is § 547(e). Prior to BAPCPA, § 547(e) provided as follows:
(e)(1) For the purposes of this section—
(A) a transfer of real property other than fixtures ... 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....
(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 10 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 10 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) 10 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.
11 U.S.C. § 547(e) (2004).
In examining the rationale behind § 547(e), we return briefly to § 547(b), specifically § 547(b)(2), under which a trustee must demonstrate that the transfer was made “for or on account of an antecedent debt owed by the debtor before such transfer was made.” 11 U.S.C. § 547(b)(2). A debt is antecedent if it is incurred before the transfer in question. See 5 Collier on Bankruptcy ¶ 547.03[4], In the context of a loan, the borrower incurs the debt at the time the lender disburses the loan proceeds. See, e.g., Spradlin v. Inez Deposit Bank (In re Lowe), 92 Fed.Appx. 129, 132 (6th Cir.2003); Burks v. Mortgage Elec. Registration Sys. (In re *465Pendergrass), 365 B.R. 833, 834 (Bankr.S.D.Ohio 2007). Therefore, lenders who advance loan proceeds prior to the recording of the mortgage are undertaking “a transfer of an interest in the subject property for purposes of § 547.” Superior Bank, FSB v. Boyd (In re Lewis), 398 F.3d 735, 746 (6th Cir.2005). Such transfers are subject to preferential transfer liability.
Under this scenario, a borrower who later becomes a debtor incurs an antecedent and, at the time the mortgage is recorded, a transfer occurs for or on account of the debt that could be challenged as preferential by a trustee. Section 547(e) addresses this potential problem for lenders by providing a grace period for perfecting a security interest. As long as the mortgage is recorded within the 10-day time period,2 the associated mortgage debt will not be deemed antecedent. See In re Arnett, 731 F.2d at 364. On the other hand, if perfection occurs more than ten days after the transfer takes effect, the transfer occurs at the time of the perfection, and the debt thus will be an antecedent one. Id.
Section 547(e) also supplements the Bankruptcy Code’s general definition of “transfer,” which is codified at § 101(54).3 See Barnhill v. Johnson, 503 U.S. 393, 397, 112 S.Ct. 1386, 118 L.Ed.2d 39 (1992) (“Our task, then, is to determine [when], under the definition of transfer provided by § 101(54), and supplemented by § 547(e), the transfer that the trustee seeks to avoid can be said to have occurred.”). As the statute so states, § 547(e) defines when a transfer occurs for purposes of analyzing the avoidability of an alleged preferential transfer. Such a “transfer in real property is deemed to have taken place ‘at the time the transfer is perfected,’ if the perfection occurred outside of the ten day window.” In re Lewis, 398 F.3d at 748 (Carr, J., concurring) (quoting 11 U.S.C. § 547(e)(2)(B)).4
Applying § 547(e) to the facts of this case, we first note that the Debtor incurred his obligation under the New Loan when Chase disbursed the loan proceeds on October 6, 2003. Next, we must determine when the New Mortgage was perfected and whether the perfection occurred within pre-BAPCPA’s 10-day grace period. Under § 547(e)(1)(A), the New *466Mortgage was perfected “when a bona fide purchaser of [the Property] from the debt- or against whom applicable law permits such transfer to be perfected cannot acquire an interest that is superior to the interest of the transferee.” Here, the “applicable law” referenced in § 547(e)(1)(A) is the law of Michigan. Under Michigan law, perfection occurs upon recording. See Mich. Comp. Laws Ann. § 565.29 (2007). Therefore, a bona fide purchaser of the Property from the Debtor could have acquired an interest superior to the interest of Chase up until the date that the New Mortgage was recorded. It is undisputed that the New Mortgage was recorded on December 17, 2003, which was 72 days after the loan proceeds were disbursed — well outside the 10-day grace period. As a result, under § 547(e)(2)(B), a transfer of the Debtor’s interest in the Property occurred “at the time such transfer [was] perfected,” on December 17, 2003, and was accordingly made on account of an antecedent debt.
Arguing against this result, Chase relies on the undisputed fact that the Discharge was recorded after the New Mortgage was recorded. According to Chase, at all relevant times third parties were on notice of Chase’s secured interest in the Property. But the fact that third parties may have been on notice of Chase’s Original Mortgage is beside the point. A transfer of an interest in real estate is not necessarily perfected for purposes of § 547(e) when third parties have notice that there had been a mortgage on the property. Rather, a transfer 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.” 11 U.S.C. § 547(e)(1)(A) (emphasis added). In a case involving § 547(e)(1)(B),5 which, like § 547(e)(1)(A), incorporates the words “when” and “cannot acquire,” the Supreme Court held that:
“When” and “cannot acquire” are ostensibly straightforward references to time and action in the real world ... A creditor “can” acquire such a lien at any time until the secured party performs the acts sufficient to perfect its interest.... Not until the secured party actually performs the final act that will perfect its interest can other creditors be foreclosed conclusively from obtaining a superi- or lien. It is only then that they “cannot” acquire such a lien. Thus, the terms of § 547(e)(1)(B) apparently imply that a transfer is “perfected” only when the secured party has done all the acts required to perfect its interest....
Fidelity Fin. Servs., Inc. v. Fink, 522 U.S. 211, 216, 118 S.Ct. 651, 139 L.Ed.2d 571 (1998).6
*467As discussed above, under Michigan law, a lender whose claim is secured by a mortgage on real property has “perform[ed] the final act that will perfect its interest,” Fink, 522 U.S. at 216, 118 S.Ct. 651, only when that interest is recorded. The fact that the Discharge was not recorded until after the recording of the New Mortgage is of no moment. There was no debt to be secured under the Original Mortgage once the Original Loan was paid. Even if the Discharge was not timely recorded by the Register of Deeds (and it was not), there was no debt and a bonafide purchaser could have relied on the fact that the Original Mortgage had been released when the Original Loan was paid. Thus, it was not until the New Mortgage was recorded that a bona-fide purchaser was “foreclosed conclusively” from obtaining a superior interest in the Property. Fink, 522 U.S. at 216, 118 S.Ct. 651.
Under § 547(e)(2), if Chase had taken steps to ensure that the New Mortgage was perfected within 10 days of the Debt- or’s granting it, the date on which the transfer would have been considered made would have been October 6, 2003 — the date that the transfer “[took] effect between the transferor and the transferee.” If Chase had done so, the New Mortgage would not have been for or on account of an antecedent debt. The New Mortgage, however, was recorded 72 days after the Debtor gave Chase the mortgage and thus constituted a transfer for or on account of an antecedent debt. Therefore the date the transfer was made is December 17, 2003.
3. The Other Elements of Preference Liability
Chase does not dispute that the Trustee has established the elements of an avoidable preference set forth in subsections (b)(1), (b)(3) and (b)(4) of § 547. See In re Lee, 326 B.R. at 706 (Bankr.E.D.Mich.2005). The only issues before us, then, are: (i) whether the earmarking doctrine applies — if so, the grant of the New Mortgage to Chase would not be deemed to be a transfer of an interest of the Debtor in property; and (ii) whether Chase’s recording of the New Mortgage during the preference period resulted in diminution of the Debtor’s bankruptcy estate.
B. The Earmarking Doctrine — Transfer of an “Interest of the Debtor in Property”
1. Development and Elements of the Earmarking Defense
When the other elements of a preferential transfer are established, § 547(b)’s prefatory language sweeps into the bankruptcy estate any transfer “of an interest of the debtor in property.” Although this provision has a potentially expansive reach, it is not without limits. In addition to the exceptions to preference liability set forth in § 547(c) — none of which are at issue here — this Court adopted another limitation on § 547(b), the judicially-crafted “earmarking doctrine”:
[T]here is an important exception to the general rule that the use of borrowed funds to discharge the debt constitutes a transfer of property of the debtor: where the borrowed funds have been specifically earmarked by the lender for payment to a designated creditor, there is held to be no transfer of property of the debtor even if the funds pass through the debtor’s hands in getting to the selected creditor. See In re Hartley, 825 F.2d at 1070; In re Smith, 966 F.2d [1527, 1533 (7th Cir.1992) ]; In re Bohlen Enters., Ltd., 859 F.2d 561, 564-66 (8th Cir.1988). “The courts have said that even when the lender’s new earmarked funds are placed in the debtor’s possession before payment to the old creditor, they are not within the debtor’s *468‘control.’ ” Bohlen, 859 F.2d at 565 (citing cases).
McLemore v. Third Nat’l Bank in Nashville (In re Montgomery), 983 F.2d 1389, 1395 (6th Cir.1993).
The earmarking doctrine applies whenever a third party transfers property to a designated creditor of the debtor for the agreed-upon purpose of paying that creditor. See In re Hartley, 825 F.2d at 1070. Under such circumstances, the property is said to be “earmarked” for the designated creditor. As a result, there is deemed to have been no transfer of an interest of the debtor in property, even if the property passes through the hands of the debtor on its way to the creditor. In re Montgomery, 983 F.2d at 1395. The earmarking doctrine, then, is a judicially-created defense that may be invoked by a defendant to a preference action in an attempt to negate § 547(b)’s threshold requirement — a transfer of an interest of the debtor in property. In order for the doctrine to apply, however, it must be that: (a) the agreement is between a new creditor and the debtor for the payment of a specific antecedent debt; (b) the agreement is performed according to its terms; and (c) the transaction according to the agreement does not result in a diminution of the debtor’s estate. In re Bohlen Enters., 859 F.2d at 566.
2. The Earmarking Defense Applied to Refinancing Transactions
When applying the earmarking doctrine in the context of a refinancing transaction, courts have split over whether to characterize the refinancing as a single unitary transaction or as a number of parts.7 Although Chase suggests that the multiple-transfer approach adopted by the First Circuit in In re Lazarus has been followed only by a small minority of bankruptcy courts, it is in fact the prevailing view. See Encore Credit Corp. v. Lim, 373 B.R. 7, 17 (E.D.Mich.2007); George v. Argent Mortgage Co. (In re Radbil), 364 B.R. 355, 358 (Bankr.E.D.Wis.2007); Baker v. Mortgage Elec. Registration Sys., Inc. (In re King), 372 B.R. 337, 341 (Bankr.E.D.Ky.2007); Peters v. Wray State Bank (In re Kerst), 347 B.R. 418, 422 (Bankr.D.Colo.2006); Gold v. Interstate Fin. Corp. (In re Schmiel), 319 B.R. 520, 528 (Bankr.E.D.Mich.2005); Scaffidi v. Kenosha City Credit Union (In re Moeri), 300 B.R. 326, 329-30 (Bankr.E.D.Wisc.2003); Strauss v. Chrysler Fin. Co. (In re Prindle), 270 B.R. 743, 746-47 (Bankr.W.D.Mo.2001); Sheehan v. Valley Nat’l Bank (In re Shreves), 272 B.R. 614, 625 (Bankr.N.D.W.Va.2001); Vieira v. Anna Nat’l Bank (In re Messamore), 250 B.R. 913, 916 (Bankr.S.D.Ill.2000). See also Goodman v. S. Horizon Bank (In re Norsworthy), 373 B.R. 194, 200 n. 3 (Bankr.N.D.Ga.2007) (“Many courts have held that the ‘earmarking doctrine’ is not properly applied in the case of the transfer of a security interest.”). In actuality, the case upon which Chase relies, In re Heitkamp, 137 F.3d 1087, represents the minority view. As far as we are aware, the only courts that have followed it *469are lower courts in the Eighth Circuit, the lower courts in In re Lazarus, and the district court here.8
(a) Refinancing Viewed as Multiple Transfers
In In re Lazarus, the court recognized that a financing transaction involves several distinct transfers. See In re Lazarus, 478 F.3d at 15-16. There, the debtor refinanced her residential mortgage loan which had been held by Washington Mutual Bank with Greater Atlantic Mortgage Corporation (“GAMC”) within 90 days pri- or to filing her Chapter 7 petition. Id. at 13. The new mortgage was not recorded until 14 days after GAMC disbursed funds to Washington Mutual Bank. And, as in the case before us, the mortgage discharge was not recorded until even later. Id. The Chapter 7 trustee sought to avoid the new mortgage as a preferential transfer due to the delayed perfection. Id. In response, GAMC argued that under the earmarking doctrine, the new mortgage did not result in a transfer of an interest of the debtor in property. The bankruptcy court and district court held in favor of GAMC.9 Id. at 14. The In re Lazarus court, however, sided with the trustee, holding that “because the [filing of the mortgage] occurred 14 days after the initial transfer of funds, section 547(e) requires that the transfer be deemed to have occurred on the date of perfection. The mortgage, therefore, secured a debt antecedent to the transfer rather than simultaneous with it.” Id. at 15. The First Circuit reasoned: “[I]n refinancing there are multiple transactions, including a new loan to the debtor, a mortgage back from the debtor to the new lender, a pre-arranged use of the proceeds of the loan to pay off the old loan and the release of the old mortgage.” Id. at 15-16. The court then rejected GAMC’s contention that the transferred property interest was not that of the debtor, holding that the earmarking doctrine did not shield the transfer challenged by the trustee — the recording of the mortgage — from avoidance. Id.
(b) Refinancing Viewed as a Unitary Transaction
Chase primarily relies upon In re Heitkamp in support of its earmarking argument. In In re Heitkamp, the debtors were in the business of constructing and selling houses. 137 F.3d at 1088. In connection with their business, the debtors maintained lines of credit with several subcontractors and took out a loan with a bank secured by a mortgage on one of the houses built by the debtors. While the loan remained outstanding, the bank agreed to loan additional funds to the debtor secured by a second mortgage. Id. But instead of paying the funds directly to the debtors, the bank agreed with the debtors that it would issue cashier’s checks to specified subcontractors who had already performed work for, or provided goods to, the debtors. In exchange for the checks, the subcontractors waived their mechanic’s liens on the property against which the bank held the mortgages. The bank’s second mortgage remained unrecorded for over three months and ultimately was recorded three days before the debtors commenced their Chapter 7 case. *470The trustee sought to avoid the second mortgage. The bankruptcy court authorized the trustee to avoid the second mortgage, and the district court affirmed. Id. On appeal, the Eighth Circuit reversed, concluding that the three-prong Bohlen test was satisfied and holding that the earmarking doctrine applied to protect the second mortgage from avoidance: “The bank and the Heitkamps agreed the secured funds would be used to pay specific preexisting debts, the agreement was performed, and the transfer of the mortgage interest did not diminish the amount available for distribution to the Heitkamps’ creditors.... The Heitkamps’ assets and net obligations remained the same. Essentially, the bank took over the subcontractors’ security interest in the house.” In re Heitkamp, 137 F.3d at 1089 (citations omitted).
3. Analysis
As an initial matter, we note that Chase is not a “new creditor,” and that this alone precludes it from successfully invoking the earmarking doctrine. Because Chase refinanced its own loan with the Debtor, it cannot establish this preliminary element of the earmarking defense. See, e.g., In re Lazarus, 334 B.R. at 549 (“The earmarking doctrine requires three specific parties: the ‘debtor,’ an ‘old creditor,’ and a ‘new creditor’ who pays the debtor’s obligation to the old creditor.”); In re Bohlen Enters., 859 F.2d at 565 (same).
Yet even if we were to deem Chase to be a new creditor, the earmarking doctrine would not shield it from preference liability under the circumstances of this case. As did the First Circuit in In re Lazarus and the clear majority of courts that have decided the issue, we conclude that the earmarking doctrine does not protect the late-perfecting refinancer from preference exposure. We reach this conclusion because we find the analysis in In re Lazarus persuasive, and because we find In re Heitkamp’s unitary-transaction approach to be fundamentally flawed in several respects.
First, In re Heitkamp’s unitary-transaction theory ignores the plain meaning of the Bankruptcy Code. The common theme in the Supreme Court’s bankruptcy jurisprudence over the past two decades is that courts must apply the plain meaning of the Code unless its literal application would produce a result demonstrably at odds with the intent of Congress. See, e.g., Hartford Underwriters Ins. Co. v. Union Planters Bank, Nat'l Ass’n, 530 U.S. 1, 6, 120 S.Ct. 1942, 147 L.Ed.2d 1 (2000) (“[W]hen the statute’s language is plain, the sole function of the courts — at least where the disposition required by the text is not absurd — is to enforce it according to its terms.”) (quotations omitted); Connecticut Nat'l Bank v. Germain, 503 U.S. 249, 253-54, 112 S.Ct. 1146, 117 L.Ed.2d 391 (1992) (“[I]n interpreting a statute a court should always turn first to one, cardinal canon before all others. We have stated time and again that courts must presume that a legislature says in a statute what it means and means in a statute what it says there. When the words of a statute are unambiguous, then, this first canon is also the last: judicial inquiry is complete.”) (citations and quotations omitted); United States v. Ron Pair Enters., Inc., 489 U.S. 235, 241, 109 S.Ct. 1026, 103 L.Ed.2d 290 (1989) (“[W]here, as here, the statute’s language is plain, the sole function of the courts is to enforce it according to its terms.”) (citations and quotations omitted).10 In re Heitkamp’s extension of the *471earmarking defense to a debtor’s transfer of a lien interest has been rightly criticized as a violation of this cardinal principle. See In re Lazarus, 478 F.3d at 16. (“Although [In re Heitkamp] supports the bankruptcy judge’s use of the earmarking doctrine in a like case, this approach has been justly opposed on the ground that it amounts to ignoring the statutory language.”) (citations omitted); Encore Credit, 373 B.R. at 16 (“Heitkamp has been justly criticized because it ignores the statutory language.”). Specifically, In re Heitkamp’s unitary-transaction approach ignores the definition of “transfer” set forth in § 101(54), as supplemented by § 547(e). Application of this definition to Lee’s refinancing transaction with Chase leads to the inescapable conclusion that it was comprised of two transfers by the Debtor — a transfer of the proceeds of the New Loan to Chase to pay off the Original Loan and the grant of the New Mortgage to Chase to secure his obligation to repay the New Loan.
Chase urges us to follow In re Heitkamp and turn a blind eye to the plain meaning of the term “transfer” contained in §§ 101(54) and 547(e). We decline Chase’s invitation to conflate the two transfers made by Lee in the refinancing transaction and treat them as one for purposes of applying the earmarking defense. To do so would ignore what actually occurred in the transaction and disregard the Bankruptcy Code’s plain meaning. See In re Lazarus, 478 F.3d at 16 (“[T]he earmarking concept does not provide [the refinancer] an escape from the plain language of [the Bankruptcy Code] in the case of a belatedly-perfected transfer of a security interest.”). See also In re Lewis, 398 F.3d at 746 (“The recording of a mortgage constitutes a transfer of an interest in the subject property for purposes of § 547.”).
Second, applying earmarking to the transfer of a lien interest — as opposed to a transfer of funds — extends the doctrine beyond its logical limits. A debtor’s grant of a mortgage lien in a refinancing transaction does not involve a transfer of “earmarked” property. Here, Lee did not serve as a conduit for the transfer of property from a third party to Chase. Rather, the transfer challenged by the Trustee— Lee’s grant of a mortgage to Chase — was most assuredly that of a property interest owned and controlled by the Debtor. See In re Lazarus, 478 F.3d at 15 (“[U]se of the earmarking doctrine in this case is not *472conceptually similar to the guarantor or new creditor cases where it could plausibly be argued that there was merely an arrangement between third parties with no property transfer by the debtor.”); In re Schmiel, 819 B.R. at 528 (“[Although the debtor’s transfer to [the refinancing creditor] arose in the context of a refinancing arrangement, it did not involve the payment of funds by a third party or, indeed, the payment of borrowed funds at all. For this reason, the earmarking doctrine has no logical relevance to such transfer.”) (quoting Messamore, 250 B.R. at 917); David Gray Carlson & William H. Widen, The Earmarking Defense to Voidable Preference Liability: A Reconceptualization, 73 Am. Bankr.L.J. 591, 602 n. 63 (Summer 1999) (“[In re Heitkamp ] wrongly invoked earmarking in a context in which the concept does not fit.”).
Third, to successfully invoke the earmarking defense, a preference defendant must demonstrate that the transfer in question did not result in a diminution of the debtor’s bankruptcy estate. Although Chase claims no diminution, it arrives at this conclusion by pointing to its status at the' inception of the refinancing transaction, a time when it indisputably had a perfected mortgage on the Property, and its status at the conclusion of the transaction — when it again had a perfected mortgage — and ignoring everything that happened in between. But focusing on the actual transfer at issue, Chase’s perfection of the New Mortgage, clearly reveals that Lee’s bankruptcy estate was in fact diminished. From the point that the New Loan was made and the Original Mortgage discharged up until such time as the New Mortgage was recorded, Chase did not hold a perfected lien interest. Thus, Chase’s subsequent perfection of the New Mortgage diminished Lee’s estate because the non-exempt equity in the Property that otherwise would have been available for distribution to Lee’s unsecured creditors became encumbered, and unavailable to unsecured creditors, by the New Mortgage that Chase received.
Finally, applying the earmarking doctrine to insulate Chase from preference liability would essentially write § 547(e) out of the Bankruptcy Code and, in the process, defeat the sound policy the statute was intended to promote — the discouragement of secret liens. By enacting § 547(e) and establishing a definite and firm 10-day time period for lien perfection (now expanded to 30 days by BAPCPA), Congress sought to promote the Bankruptcy Code’s policy of discouraging secret liens on property of the estate. See In re Lazarus, 478 F.3d at 18; In re Arnett, 731 F.2d at 363.
For all these reasons, we conclude that the earmarking doctrine does not protect Chase from preference liability.
C. Diminution— § 547(b)(5)
Chase contends, and the Trustee concedes, that § 547(b)(5) requires that the Trustee establish diminution in order to prevail. As we have already explained, the lapsed perfection of the Original Mortgage and Chase’s late perfection of the New Mortgage diminished the Debtor’s estate. That is, Chase’s security interest in the Property was released and re-perfected, and diminution occurred when Lee’s unencumbered, non-exempt equity in the Property once again became subject to a perfected lien when the New Mortgage was recorded.11
*473D. Chase’s Policy Argument
Chase argues that imposing preference liability on it would be unfair and against public policy because the refinancing transaction involved a mere substitution of its New Mortgage for the Original Mortgage and ultimately benefitted the Debtor’s other creditors, not Chase. According to Chase, the refinancing reduced the amount of the Debtor’s monthly mortgage payments, causing more funds to be available for other creditors. Moreover, Chase argues, it derived no benefit from the refinancing transaction and should not be penalized for assisting the Debtor in his attempt to avoid bankruptcy. However, “whatever equitable powers remain in the bankruptcy courts must and can only be exercised within the confines of the Bankruptcy Code.” Norwest Bank Worthington v. Ahlers, 485 U.S. 197, 206, 108 S.Ct. 963, 99 L.Ed.2d 169 (1988). See also Southmark Corp. v. Grosz (In re Southmark Corp.), 49 F.3d 1111, 1116 (5th Cir.1995) (“Although § 105(a) of the Bankruptcy Code authorizes bankruptcy courts to fashion such orders as are necessary to further the substantive provisions of the Code, that provision does not ... empower bankruptcy courts ... to act as roving commissions to do equity.”) (quotations omitted).
The problems that arise when courts effectively rewrite bankruptcy statutes in order to reach a result deemed “equitable” are illustrated by the bankruptcy court’s decision that was reversed by In re Lazarus. Apparently recognizing the potentially open-ended effect of its ruling, the bankruptcy court there stated that it was not holding “that the earmarking doctrine necessarily applies to a refinancing transaction where the length of time between the transfer of value to the old creditor and the perfection of the new security interest is so extensive that a material issue of fact has arisen relative to the parties’ intention.” In re Lazarus, 334 B.R. at 553. But that begs the question: What length of time period would be too extensive — six months, one year, longer? The approach taken by that court, overturned by the First Circuit in In re Lazarus, and the approach advocated by Chase here substitutes the judgment of the courts for that of Congress. Congress, by enacting § 547(e)(2), has determined the appropriate length of time between a creditor’s transfer of value and perfection: originally 10 days, now expanded to 30 days by BAPCPA. By hewing to the plain meaning of the Code and respecting Congress’s judgment in enacting § 547(e)(2), our holding today fosters predictability in the law of preferences.
Moreover, the result in this case, although arguably harsh, could have readily been prevented by Chase. On this point, our prior decision in In re Lewis is instructive. There, a late-perfecting mortgagee argued that we should apply the doctrine of equitable subrogation to insulate it from preference liability. In re Lewis, 398 F.3d at 746-47. In declining to apply the equi*474table ' subrogation doctrine to shield the late-perfecting mortgagee from preference liability, we noted that the mortgagee was a sophisticated creditor facing a problem of its own making:
[The late-perfecting mortgagee] is a sophisticated creditor who had complete control over the recording of the signed mortgage. It offers no explanation for the more than seven-month delay between the signing and recording of the mortgage. Its own negligence led to the dilemma created by the debtor’s filing for bankruptcy.
Id. at 747. See also In re Lazarus, 478 F.3d at 16 (“[T]he penalty [of lien avoidance] is not without a general benefit— pour encourager les autres — and is easily avoided by recording within 10 days as the statute directed.”).
Chase is a sophisticated lender well aware of the consequences of failing to perfect its security interest within the grace period afforded by § 547(e)(2) — a deadline in effect since the enactment of the Bankruptcy Code more than a quarter century ago. We simply are not at liberty to rewrite the Code’s preference provision under the rubric of doing equity to protect late-perfecting secured creditors.
III. CONCLUSION
For the foregoing reasons, we hold that the recording of the New Mortgage is a preferential transfer under § 547(b). Accordingly, we REVERSE the decision of the district court and AFFIRM the opinion of the Bankruptcy Court.
. Because the Debtor filed his bankruptcy case prior to the effective date of The Bankruptcy Abuse Prevention and Consumer Protection Act of 2005 ("BAPCPA”), the preamendment law applies, and references in this opinion to the Bankruptcy Code, unless otherwise noted, are to the pre-amendment version.
. BAPCPA increased the grace period from 10 days to 30 days. The New Mortgage was recorded well outside even the new 30-day grace period and, thus, the result would be the same under either version of the law.
. Prior to BAPCPA, "transfer” was defined as "every mode, direct or indirect, absolute or conditional, voluntary or involuntary, of disposing of or parting with property or with an interest in property, including retention of title as a security interest and foreclosure of the debtor's equity of redemption.” 11 U.S.C. § 101(54) (amended 2005). Under BAPCPA, the definition of “transfer” is substantially the same, but was amended to expressly include "the creation of a lien,” "the retention of title as a security interest” and "the foreclosure of a debtor's equity of redemption.” 11 U.S.C. § 101(54).
. In In re Lewis, the Chapter 7 trustee sought to avoid as a preferential transfer a mortgage the debtor had granted a bank in connection with the debtor’s refinancing of a prior mortgage. The new mortgage was recorded several months after the refinancing and less than 90 days before the debtor filed a bankruptcy petition. 398 F.3d at 738. Under these circumstances, we held that the recording constituted a transfer for purposes of § 547 and affirmed the summary judgment entered in favor of the trustee avoiding the bank's mortgage. Id. at 746-48. See also In re Arnett, 731 F.2d at 363 ("Section 547(e)(2)(A) and (B) ... provid[e] that a transfer of a security interest relates back to the date of the underlying transaction if perfection occurs no more than 10 days afterwards; if perfection occurs more than 10 days later, the transfer is deemed to occur at the date of perfection.”).
. Section 547(e)(1)(B) deals with transfers of personal property and fixtures, while § 547(e)(1)(A) governs transfers of real property. Section 547(e)(1)(B) states:
(e)(1) For the purposes of this section—
(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.
11U.S.C. § 547(e)(1)(B).
. The Supreme Court held that by "acts necessary to perfect a security interest under state law” it meant "whatever acts must be done to effect perfection under the terms of the applicable state statute, whether those be acts of a creditor or acts of a governmental employee delivering or responding to a creditor’s application.... [T]he time within which those acts must be done is governed by federal, not state, law, when the issue is the voidability of a preference under the Bankruptcy Code.” Fink, 522 U.S. at 213 n. 1, 118 S.Ct. 651. The "acts necessary to perfect,” therefore, include the recording of the New Mortgage by the Register of Deeds.
. This Court has already rejected the unitary transaction theory proposed by Chase in a context similar to this one, but where the creditor failed to record an original mortgage within 10 days. See Moyer v. RBC Mortgage Co (In re Maracle), 159 Fed.Appx. 692 (6th Cir.2005). In that unpublished decision, this Court adopted the analysis of then-District Judge McKeague’s opinion in the same case, In re Maracle, No. 1:04-CV-151 (W.D.Mich.2004). In re Maracle adopts the two-transaction theory for a situation in which the lender fails to record the mortgage within the 10-day period. Id. at 3-4. While that decision is not binding on this Court, the case is consistent with this Court’s treatment of creditors under the Bankruptcy Code, as well as with the First Circuit's treatment of this situation in Collins v. Greater Atlantic Mortgage Corp. (In re Lazarus), 478 F.3d 12 (1st Cir.2007).
. Chase argues that this Court has followed In re Heitkamp in an unpublished opinion. (Chase Br. 13 n. 6). However, the case Chase cites, Peoples Bank & Trust Co. v. Burns, 95 Fed.Appx. 801 (6th Cir.2004), merely cites the definition of the earmarking doctrine in In re Heitkamp and does not reference that court's application of the doctrine.
. Chase relies on this bankruptcy court decision without mentioning that it was reversed by the First Circuit in In re Lazarus — a case that Chase failed to cite.
. Other cases in which the Supreme Court has applied the plain meaning approach in *471the bankruptcy context in the last two decades include: Travelers Cas. & Sur. Co. of Am. v. Pac. Gas and Elec. Co., 549 U.S. 443, 127 S.Ct. 1199, 1204, 167 L.Ed.2d 178 (2007); Till v. SCS Credit Corp., 541 U.S. 465, 486, 124 S.Ct. 1951, 158 L.Ed.2d 787 (2004) (Thomas, L, concurring); Lamie v. United States Trustee, 540 U.S. 526, 534, 124 S.Ct. 1023, 157 L.Ed.2d 1024 (2004); FCC v. NextWave Pers. Commc'ns Inc., 537 U.S. 293, 304, 123 S.Ct. 832, 154 L.Ed.2d 863 (2003); Rake v. Wade, 508 U.S. 464, 472-73, 113 S.Ct. 2187, 124 L.Ed.2d 424 (1993); Patterson v. Shumate, 504 U.S. 753, 757-58, 112 S.Ct. 2242, 119 L.Ed.2d 519 (1992); Taylor v. Freeland & Kronz, 503 U.S. 638, 642-43, 112 S.Ct. 1644, 118 L.Ed.2d 280 (1992); Union Bank v. Wolas, 502 U.S. 151, 158, 112 S.Ct. 527, 116 L.Ed.2d 514 (1991); and Toibb v. Radloff, 501 U.S. 157, 160, 111 S.Ct. 2197, 115 L.Ed.2d 145 (1991). See generally Marjorie O. Rendell, 2003 — A Year of Discovery: Cybergenics and Plain Meaning in Bankruptcy Cases, 49 Vill. L.Rev. 887, 887 (2004) (“No doubt the major methodological development in Supreme Court jurisprudence over the last few decades has been the ascendancy of the plain meaning approach to interpreting statutes.”); Walter A. Effross, Grammarians at the Gate: The Rehnquist Court’s Evolving “Plain Meaning” Approach to Bankruptcy Jurisprudence, 23 Seton Hall. L.Rev. 1636, 1638 (1993) ("To reconcile the conflicting goals of the Code and to coordinate the Code's interaction with other federal statutes and with state laws, the [Supreme] Court has increasingly embraced a ‘plain meaning' approach to the statutory text.”).
. The cases upon which Chase relies in support of it’s argument that no diminution occurred are neither controlling nor persuasive. The In re Pitman decision turned on the defense of contemporaneous exchange for new value, a defense that not been reused here. *473843 F.2d at 241-42. In In re Lowe, it was undisputed that the mortgage was recorded and thus perfected only seven days after the transfer took effect — safely within the 10-day grace period established by § 547(e)(2). 92 Fed.Appx. at 133. By operation of § 547(e)(2), then, the transfer at issue in Lowe was not on account of antecedent debt, and this fact alone determined the outcome of the case. Chase's reliance on the Supreme Court decision of New York County Nat’l Bank v. Massey, 192 U.S. 138, 24 S.Ct. 199, 48 L.Ed. 380 (1904) is distinguishable because, unlike that case, here, the Debtor held title to the Property prior to the execution of the New Mortgage. Id. at 146. The bankruptcy court’s holding in Gregory v. Cmty. Credit Co. (In re Biggers), 249 B.R. 873 (Bankr. M.D.Tenn.2000), is distinguishable because there the security interest in the car was continuously perfected throughout the preference period. Id.