
    379 P.3d 257
    MARKHAM CONTRACTING CO., INC., an Arizona corporation, Plaintiff/Appellant, v. FEDERAL DEPOSIT INSURANCE COMPANY, as receiver for First Arizona Savings and Loan Association, a federal savings bank; Primeaz/Libra, LLC, an Arizona limited liability company, Defendants/Appellees.
    No. 1 CA-CV 14-0752
    Court of Appeals of Arizona, Division 1.
    FILED 8/9/2016
    
      Osborn Maledon, P.A., Phoenix, By Thomas L. Hudson, Eric M. Fraser, Co-counsel for PlaintiffAppellant
    Palecek & Palecek PLLC, Scottsdale, Karen A. Palecek, Co-counsel for Plaintiff/Appellant
    Gust Rosenfeld P.L.C., Phoenix, By Frank S. Tomkins, Scott A. Malm, Counsel for Defendant/Appellee Federal Deposit Insurance Company
    Hennelly & Grossfeld LLP, Scottsdale, By Richard Q. Nye, Benjamin J. Branson, Counsel for Defendant/Appellee PrimeAZ/Libra, LLC
    Presiding Judge Peter B. Swann delivered the opinion of the court, in which Judge Lawrence F. Winthrop and Judge Donn Kessler joined.
   OPINION

SWANN, Judge:

¶ 1 This is a foreclosure case. Markham Contracting Co. (“Markham”) perfected a mechanic’s lien on a property in second position to a first deed of trust. Lenders made a secured construction loan that was used, in part, to satisfy and release the first-position loan and deed of trust on the subject property. The lenders later foreclosed on the second deed of trust, using a credit bid, and claimed to extinguish Markham’s mechanic’s lien on a theory of equitable subrogation. Markham challenged the priority of the lenders’ interest and demanded that it be paid from the proceeds of the sale.

¶ 2 We hold that the second loan and deed of trust were subrogated to the original loan and deed of trust’s first-priority position to the extent of the payoff amount. We conclude that such subrogation caused no material prejudice to Markham, whose lien was never superior to the first deed of trust. We also hold, however, that the lenders’ foreclosure on their deed of trust did not extinguish Markham’s interest. At the trustee’s sale, the lenders made a “credit bid” that exceeded the subrogation amount, thereby acquiring the property and retaining the full amount of their bid (minus the costs and expenses of the trustee’s sale) when the portion of the bid in excess of the subrogation amount should have been distributed to the appellant, or the appellant’s lien left in place. Because no proceeds were distributed, we hold that the doctrine of equitable subrogation requires that the appellant’s lien remain in place.

¶ 3 We affirm the superior court’s determination that the appellees were equitably sub-rogated to the first-priority position to the extent that the second loan was used to satisfy the first. We reverse and remand with respect to the court’s ruling that the subro-gation led to the extinguishment of the appellant’s lien.

FACTS AND PROCEDURAL HISTORY

¶ 4 Troon Canyon Ventures, LLC (“Troon”) purchased real property (“the Property”) with a $4.1 million-maximum loan (“the 2006 Loan”) from First Arizona Savings and Loan Association (“First Arizona”), secured by a deed of trust on the Property recorded on April 7, 2006 (“the 2006 Deed of Trust”).

¶ 5 Troon hired Pinnacle Point Developers, LLC (“Pinnacle”) as general contractor to develop the Property. Pinnacle, in turn, subcontracted with Markham to perform grading, paving, and water utility work. Markham began work on the Property on June 10, 2008, and promptly complied with the preliminary notice requirements of A.R.S. § 33-992.01.

¶ 6 First Arizona and PrimeAZ/Libra, L.L.C. (“PrimeAZ”) later loaned Troon $4.8 million (“the 2008 Loan”) to fund the Property’s ongoing development; a corresponding deed of trust encumbering the Property was recorded on September 9, 2008 (“the 2008 Deed of Trust”), Approximately $2.9 million of the 2008 Loan’s proceeds were used to pay off the balance owing on the 2006 Loan, which was then several months overdue. On September 10, 2008, a deed was recorded releasing the 2006 Deed of Trust.

¶ 7 First Arizona and PrimeAZ declared the 2008 Loan in default in late August 2009 and demanded that Troon make payment in full by September 25. Markham recorded its mechanic’s lien on September 2.

¶8 On November 19, First Atizona and PrimeAZ recorded a notice of trustee’s sale on the 2008 Deed of Trust. Markham, upon receiving notice of the impending sale, informed First Atizona and PrimeAZ by letter that in Markham’s view, any purchaser at the trustee’s sale would take the Property subject to Markham’s mechanic’s lien. First Arizona responded that its title insurance policy showed that the 2008 Deed of Trust held first priority. First Arizona stated that it had forwarded Markham’s claim to its title insurer, and that “[i]n the meantime, we will proceed with our foreclosure sale.” First Arizona further asserted that Markham did not retain a lien based on failure to comply with preliminary notice requirements, and stated that its previous conversations with Markham had led it to believe that Markham would not assert any lien claims.

¶ 9 Markham filed a lien foreclosure action in January 2010, requesting, among other things, a declaration of its lien’s validity and an order that the Property be sold and Markham be paid from the sale proceeds.

¶ 10 The trustee’s sale noticed by First Arizona and PrimeAZ took place in late February 2010, with First Arizona and PrimeAZ purchasing the Property for a $3.175 million credit bid. Fust Arizona and PrimeAZ answered Markham’s complaint in March 2010; eight months later, they sought leave to file an amended answer and declaratory-relief counterclaim in which they alleged, for the first time, that the 2008 Deed of Trust was equitably subrogated to the 2006 Deed of Trust’s first-priority position. The court granted the lenders leave to amend over Markham’s objection.

¶ 11 In a series of summary judgment rulings, the court held that while Markham held a valid lien for approximately $341,700, the 2008 Deed of Trust was subrogated to the 2006 Deed of Trust’s first-priority position to the extent that the 2008 Loan was used to satisfy the 2006 Loan. Further, the court held that the trustee’s sale extinguished Markham’s lien. The court also entered summary judgment for the lenders on Markham’s claims for unjust enrichment, promissory estoppel, and misdistribution of the sale proceeds.

¶ 12 Markham timely appeals.

DISCUSSION

¶ 13 We review a grant of summary judgment de novo, viewing the facts in the light most favorable to Markham. Andrews v. Blake, 205 Ariz. 236, 240, ¶ 12, 69 P.3d 7 (2003).

I. BOTH EQUITABLE SUBROGATION AND REPLACEMENT REQUIRE CONSIDERATION OF THE TOTALITY OF THE EQUITIES.

¶ 14 Though the parties treated the doctrines of equitable subrogation and replacement as interchangeable in the proceedings below, they now dispute which doctrine may apply. Markham argues in favor of equitable subrogation but asserts that there is no material difference between it and replacement; First Arizona’s receiver and PrimeAZ argue in favor of replacement and contend that it, unlike equitable subrogation, “is not limited by the caveat that it will apply only to the extent necessary to avoid unjust enrichment” and does not require a “ease-by-case analysis” to determine its availability.

¶ 15 We agree with Markham that the doctrines are not materially different. Both equitable subrogation and replacement allow a deed of trust to assume the priority position of an earlier deed of trust irrespective of intervening liens. Restatement (Third) of Property: Mortgages (hereinafter “Restatement”) §§ 7.3, 7.6 (1997). But because a lender cannot be subrogated to its own previous deed of trust, an original lender’s refinancing loan is treated as a “replacement” loan instead of a subrogated loan. Restatement § 7.6 cmt. e; Cont’l Lighting & Contracting, Inc. v. Premier Grading & Utilities, LLC, 227 Ariz. 382, 385-86, ¶¶ 9-11, 258 P.3d 200 (App. 2011); Brimet II, LLC v. Destiny Homes Marketing, LLC, 231 Ariz. 457, 460, ¶ 12, 296 P.3d 993 (App. 2013). The rationale of both doctrines, however, is identical: an intervening lienholder generally will not be prejudiced by maintaining the same position it occupied before the later deed of trust was established. See Restatement § 7.6 cmts. a, e. To accommodate exceptions, both doctrines include an equitable limitation: they will give way when the intervening lienholder would be unfairly harmed by maintaining its original subordinate position. See Restatement §§ 7.6(a) & cmts. e & f, 7.3(a)(1) & cmt. b.

¶ 16 For purposes of equitable subrogation, the Restatement phrases the equitable limitation in terms of “unjust enrichment,” and, as an example, explains that subrogation is appropriate to prevent unjust enrichment if the person seeking subrogation performs a debtor’s obligation on the promise of repayment and a reasonable expectation of receipt of a security interest, and subrogation would not “materially prejudice” the intervening lienholder. Restatement § 7.6(a), (b)(4).

¶ 17 For purposes of replacement, the Restatement describes the equitable limitation as “change[s] in the terms of the mortgage or the obligation it secures ... [that are] materially prejudicial.” Restatement §§ 7.6(a), 7.3(a)(1). First Arizona and Pri-meAZ contend that the equitable limitation on replacement is narrower than that on equitable subrogation. But nothing in the terms of the Restatement compels such a conclusion. Moreover, Restatement § 7.6 cmt. e specifically explains that “[t]he result [of replacement] is analogous to subrogation, and under this Restatement the requirements are essentially similar to those for subrogation.” See also Sheppard v. Interbay Funding, LLC, 305 S.W.3d 102, 108 n.6 (Tex. App. 2009) (noting that under the Restatement, the characterization of a claim as one for equitable subrogation versus one for replacement is “without significant consequence”). And indeed, it would make little sense to treat intervening lienholders differently based on whether it is the same or a different lender who seeks priority for a new deed of trust—the lender’s identity has no bearing on the question of what is fair to the subordinate lienholder. Cf. Sanders v. Folsom, 104 Ariz. 283, 289, 451 P.2d 612 (1969) (“[Equity] looks to the substance rather than the form.... And once rightfully possessed of a case it will not relinquish it short of doing complete justice.” (citation omitted)).

¶ 18 We conclude that the court must examine the totality of the equities when considering whether (and how) to apply either equitable subrogation or replacement. Here, therefore, it is of no practical consequence whether the structure of the 2008 Loan required that the analysis be undertaken under the rubric of “equitable subrogation” or “replacement.” We need not decide which title to assign our analysis. We refer to equitable subrogation for convenience only, as the majority of our state’s case law concerns that doctrine.

II. THE 2008 DEED OF TRUST WAS SUBROGATED TO THE 2006 DEED OF TRUST’S FIRST-PRIORITY POSITION TO THE EXTENT THAT THE 2008 LOAN WAS USED TO SATISFY THE 2006 LOAN.

¶ 19 Equitable subrogation allows a deed of trust to assume the priority position of an earlier deed of trust despite intervening liens (including mechanic’s liens) that would otherwise be senior to the later deed of trust. Restatement § 7.6; Weitz Co. L.L.C. v. Heth, 236 Ariz. 405, 407, ¶ 1, 333 P.3d 23 (2014). The doctrine is designed to prevent intervening lienholders from receiving an unearned promotion in priority at the successor lender’s expense. Lamb Excavation, Inc. v. Chase Manhattan Mortg. Corp., 208 Ariz. 478, 480, ¶ 6, 95 P.3d 542 (App. 2004). When a lienholder acquires its interest subject to an earlier-priority loan, it accepts the risk that the property owner will not pay that loan and the intervening lien will thereby be defeated. Id. at 483, ¶ 18, 95 P.3d 542; see also BAC Home Loans Servicing, LP v. Semper Invs. L.L.C., 230 Ariz. 587, 591, ¶ 9, 277 P.3d 784 (App. 2012). To allow the intervening lien-holder to advance its priority status merely because the earlier-priority loan has been refinanced would be to give the lienholder an undeserved windfall. BAC Home Loans, 230 Ariz. at 591, ¶ 9, 277 P.3d 784. In such circumstances, subrogation will typically leave the lienholder “no worse off than before the senior obligation was discharged,” because the lienholder’s “position is not materially prejudiced, but is simply unchanged.” Restatement § 7.6 cmts. a, e.

¶ 20 But because subrogation is an equitable remedy, its application “depends upon the particular facts and circumstances of each case as it arises.” Mosher v. Conway, 45 Ariz. 463, 468, 46 P.2d 110 (1935). “Subro-gation can only be granted when an equitable result will be reached.” Sun Valley Fin. Servs. of Phoenix, L.L.C. v. Guzman, 212 Ariz. 495, 499, ¶ 18, 134 P.3d 400 (App. 2006). And it will apply only “to the extent necessary to prevent unjust enrichment.” Restatement § 7.6(a). Accordingly, subrogation will be allowed only to the extent that the lower-priority loan was used to pay off the earlier-priority loan. Stock Growers’ Fin. Corp. v. Hildreth, 30 Ariz. 505, 513, 249 P. 71 (1926); Brimet II, 231 Ariz. at 460, ¶ 14, 296 P.3d 993; Restatement § 7.6 cmt. e.

¶ 21 Prejudice to the subordinate lien-holder may result and bar equitable subrogation when the second lender “delay[s] ... in recording his or her new mortgage, in demanding and recording a written assignment, or in otherwise publicly asserting subrogation to the mortgage paid.” Restatement § 7.6 cmt, f. But delayed public notice does not by itself establish prejudice. BAC Home Loans, 230 Ariz. at 592, ¶ 11, 277 P.3d 784. Prejudice results only if the delay “leadfe] the holder of an intervening interest to take detrimental action in the belief that that interest now has priority.” Restatement § 7.6 cmt. f. For example, a contractor-lienholder might be unfairly prejudiced by subrogation if the contractor started its work during a period when only the release of the original deed of trust—and not the second deed of trust&wkey;was part of the public record. Restatement § 7.6 cmt. f, 30. Depending on the facts, the contractor might have reasonably undertaken its work with the expectation that it held a first-priority lien, and subrogation might therefore be inequitable.

¶22 Here, Markham was on notice when it began its work that the Property was encumbered by the 2006 Deed of Trust. Allowing the 2008 Deed of Trust to be subro-gated to the extent of the outstanding bal-anee of the 2006 Loan did nothing to alter the risk that Markham voluntarily assumed at the time it established its lien. Markham nonetheless contends that subrogation was inequitable because the lenders’ post-lien, post-loan conduct gave them an unfair advantage at the trustee’s sale and allowed them to purchase the property without paying Markham. Markham contends that it, and perhaps others, would have participated in the trustee’s sale had the lenders publicly asserted their intent to claim subrogation and had First Arizona not told Markham that it held a senior lien and would be paid. It further contends that it continued to improve the Property even after Pinnacle stopped paying because First Atizona assured Markham that the project would continue and Markham would be paid. The type of harm that Markham describes could provide a cause of action for money damages—an avenue for relief that Markham unsuccessfully pursued in its unjust enrichment and promissory estoppel claims. But it has no bearing on the equitable subrogation analysis. For purposes of equitable subrogation, “prejudice is determined by evaluating the risk undertaken by the intervening lienholder at the time it made the loan [or established its mechanic’s lien].” BAC Home Loans, 230 Ariz. at 591, ¶ 9, 277 P.3d 784 (emphasis added). We disagree with In re Mortgages Ltd., 482 B.R. 298, 310-11 (Bankr. D. Ariz. 2012), on which Markham relies, to the extent that decision suggests otherwise.

¶ 23 Our decision, however, does not turn on the questions of reliance or misrepresentation. Nothing that the lenders did altered Markham’s original footing. The superior court therefore properly held that the 2008 Deed of Trust was subrogated to the 2006 Deed of Trust’s priority position to the extent that approximately $2.9 million of the 2008 Loan was used to pay off the 2006 Loan.

III. THE TRUSTEE’S SALE DID NOT EXTINGUISH MARKHAM’S LIEN,

¶ 24 Though the lenders’ delay in publicly asserting their intent to seek equitable sub-rogation is not fatal to their subrogation claim, the manner in which they purported to use a credit bid to extinguish Markham’s lien was contrary to law and calculated to lead to inequity.

¶ 25 The trustee’s sale was noticed and conducted under the 2008 Deed of Trust. That was not only appropriate but necessary, because the 2006 Deed of Trust had been released. But First Arizona and PrimeAZ purported to purchase the Property for a “credit bid” on the 2008 Deed of Trust that exceeded the portion of the 2008 Deed of Trust’s security interest that was subrogated to the first-priority position—the lenders bid $3.175 million when only $2.9 million of the 2008 Loan was secured by a first-priority interest. By definition, a “credit bid” is limited to “an amount up to the full amount of the contract or contracts secured by the trust deed.” A.R.S. § 33-801(5). Because First Arizona and PrimeAZ’s bid exceeded the portion of the 2008 Loan that had priority, on this record Markham should have received the excess portion under AR.S. § 33-812(A)(5), But that did not occur.

¶ 26 First Arizona and PrimeAZ contend that Markham’s only recourse for the nonpayment would be litigation against the trustee who distributed the sale proceeds. But the unlawful “credit bid” allowed the lenders to take the Property free of Markham’s lien without having to actually pay for anything other than the costs and expenses of the sale. See AR.S. §§ 33-811(E) (trustee’s deed conveys property free of all liens junior to the foreclosed deed of trust), -812(A)(l)-(3) (after costs and expenses of trustee’s sale are paid, sale proceeds are to be applied to the obligations owed to the trust or). The superior court’s ruling gave the lenders an undeserved windfall at the expense of Markham’s legitimate expectations. Equity cannot condone that result.

¶ 27 In Sourcecorp, individuals purchased residential property for $667,500, and $621,000 of that was used to satisfy and release the first-position loan and deed of trust on the property. 229 Ariz. at 271, ¶ 2, 274 P.3d 1204. An intervening lienholder held a $3 million judgment lien. Id, Recognizing that the subrogees were cash purchasers rather than creditors, the supreme court held that “the purposes of equitable subrogation are fully served by deeming the [homeowners] to have a priority to proceeds from any sale of the property in the amount they paid to satisfy the debt,” and that the intervening judgment lien continued to encumber the property. 229 Ariz. at 276, ¶¶ 28-29, 274 P.3d 1204. Likewise, we hold that the doctrine of equitable subrogation requires that Markham’s lien continue to encumber the property here.

¶ 28 We reject the lenders’ contention that our holding contradicts BT Capital LLC v. TD Serv. Co. of Ariz., 229 Ariz. 299, 275 P.3d 598 (2012). BT Capital examined the statutory scheme governing trustee’s sales. See id. at 300-02, ¶¶ 9-20, 275 P.3d 598. It did not address the question whether a lender may exploit the judicial doctrine of equitable sub-rogation by making a “credit bid” in excess of its security interest. Further, we note that nothing in our decision today divests the lenders of title to the Property—we merely clarify the quality of the title they purchased.

CONCLUSION

¶ 29 The superior court correctly concluded that First Arizona and PrimeAZ held a fust-priority security interest in the Property by virtue of equitable subrogation. But in view of the lenders’ so-called “credit bid” in excess of the subrogated amount, and Markham’s failure to receive the excess amount, the court erred by holding that Markham’s mechanic’s lien was extinguished by the trustee’s sale. We therefore affirm the court’s determination on equitable subrogation, but reverse its ruling that Markham’s lien was extinguished. We remand for entry of judgment for Markham consistent with this decision. See Anderson v. Country Life Ins. Co., 180 Ariz. 625, 886 P.2d 1381 (App. 1994). In the exercise of our discretion, we grant Markham’s request for attorney’s fees on appeal subject to compliance with ARCAP 21(c). 
      
      . Federal Deposit Insurance Company ("FDIC”) was appointed as First Arizona’s receiver during the course of the superior-court litigation, and, accordingly, was substituted for First Arizona in the matter. For convenience and clarity, we hereinafter refer to both First Arizona and FDIC as "First Arizona.”
     
      
      . Arizona follows the Restatement with respect to equitable subrogation and replacement. See Sourcecorp, Inc. v. Norcutt, 229 Ariz. 270, 273, ¶ 12, 274 P.3d 1204 (2012) (equitable subrogation); Cont’l Lighting & Contracting, Inc. v. Premier Grading & Utilities, LLC, 227 Ariz. 382, 387, ¶¶ 15-16, 258 P.3d 200 (App. 2011) (replacement).
     
      
      . First Arizona and PrimeAZ argue on appeal that there is insufficient reliable evidence to support Markham’s allegations of detrimental reliance. But Markham properly supported the allegations with affidavit and deposition testimony in accordance with Ariz. R. Civ. P. 56(a), and First Arizona and PrimeAZ did not dispute Markham’s allegations in a manner consistent with Ariz. R. Civ. P. 56(e).
     
      
      . The potential for mischief in any other rule is obvious. Under appellees' approach a lender who enjoyed one dollar of priority by virtue of subro-gation could use a large, essentially illusory "credit bid” to extinguish substantial interests senior to its own loan.
     