
11 Cal.App.4th 1657 (1992)
15 Cal. Rptr.2d 173
FIRST NATIONWIDE SAVINGS, Plaintiff and Appellant,
v.
DAVID PERRY, as Trustee, etc., Defendant and Respondent.
Docket No. H008601.
Court of Appeals of California, Sixth District.
December 3, 1992.
*1660 COUNSEL
Cameron & Dreyfuss, Steven R. Cameron and Lawrence J. Dreyfuss for Plaintiff and Appellant.
Adelson, Hess, Christensen & Kelly, Duane W. Shewaga and Phillip M. Adelson for Defendant and Respondent.
OPINION
ELIA, J.
First Nationwide Savings (FNS) sued Sunrise Trust for unjust enrichment and money had and received. Sunrise demurred to the second *1661 amended complaint. The demurrer was sustained without leave to amend. Judgment was entered against FNS.
On appeal, we consider whether a beneficiary (FNS) can recover for unjust enrichment from a nonassuming grantee of a purchase money deed of trust (Sunrise) after the trustee mistakenly reconveys the deed of trust and the grantee sells the property, thereby obtaining all the proceeds from the sale. For reasons we shall explain, we conclude that a cause of action may be stated. Accordingly, the judgment is reversed.

Facts and Procedural Background
In May 1983, Gary Madden borrowed $146,000 from FNS. The loan was evidenced by a written promissory note. Madden used the loan to purchase a single-family residence in Campbell, California. The note was secured by a written deed of trust in which Madden conveyed for the benefit of FNS a power of sale of the single-family residence. The deed of trust was recorded on June 2, 1983.
Madden subsequently sold the property. The purchaser took the property subject to FNS's deed of trust. In January 1986, a trustee's sale was held pursuant to the nonjudicial foreclosure of a deed of trust junior to the FNS deed of trust. Sunrise Trust, with David Perry as trustee, purchased the property at the trustee's sale. Sunrise purchased the property subject to FNS's deed of trust.
In May 1986, Master Mortgage Company (MMC), the trustee on the FNS deed of trust, mistakenly executed a reconveyance of the FNS deed of trust. The reconveyance was recorded on June 25, 1986. According to the complaint, MMC was not authorized to reconvey the deed of trust and did not intend to do so.
The trustee's deed to Sunrise was recorded on August 13, 1986.
On December 17, 1986, Sunrise sold the property to Vernon and Vera Sundberg. Because of the reconveyance, FNS did not receive any of the proceeds from the sale of the property to the Sundbergs.
In 1988, FNS sued Gary Madden for imposition of a constructive trust, money lent, conversion, cancellation of instrument, declaratory relief and breach of promissory note. In 1989, FNS filed its first amended complaint naming Sunrise as a defendant. The complaint stated causes of action for unjust enrichment and money had and received. Sunrise's demurrer to the first amended complaint was sustained with leave to amend.
*1662 On November 19, 1990, FNS filed its second amended complaint for unjust enrichment and money had and received. On April 1, 1991, Sunrise's demurrer to the second amended complaint was sustained without leave to amend. A judgment of dismissal was entered.
This appeal ensued.

Standard of Review
(1) In examining the sufficiency of the complaint, "[w]e treat the demurrer as admitting all material facts properly pleaded, but not contentions, deductions or conclusions of fact or law. [Citation.] We also consider matters which may be judicially noticed." (Serrano v. Priest (1971) 5 Cal.3d 584, 591 [96 Cal. Rptr. 601, 487 P.2d 1241, 41 A.L.R.3d 1187]; Blank v. Kirwan (1985) 39 Cal.3d 311, 318 [216 Cal. Rptr. 718, 703 P.2d 58].) "[W]e give the complaint a reasonable interpretation, reading it as a whole and its parts in their context. [Citation.] (2) When a demurrer is sustained, we determine whether the complaint states facts sufficient to constitute a cause of action. [Citation.] And when it is sustained without leave to amend, we decide whether there is a reasonable possibility that the defect can be cured by amendment: if it can be, the trial court has abused its discretion and we reverse; if not, there has been no abuse of discretion and we affirm. [Citations.] The burden of proving such reasonable possibility is squarely on the plaintiff." (Blank v. Kirwan, supra, 39 Cal.3d at p. 318.)

Discussion

I. Unjust Enrichment Cause of Action

FNS argues its complaint states a claim for unjust enrichment. In examining this contention, we must review principles of restitution and secured transactions law, as well as the pertinent case authorities. After doing so, we shall conclude that FNS's complaint can be amended to state a cause of action for unjust enrichment.

A. Restitution

We begin with the law of restitution. (3) An individual is required to make restitution if he or she is unjustly enriched at the expense of another. (Rest., Restitution, § 1; California Federal Bank v. Matreyek (1992) 8 Cal. App.4th 125, 131 [10 Cal. Rptr.2d 58].) A person is enriched if the person receives a benefit at another's expense. (Rest., Restitution, supra, § 1, com. a.) Benefit means any type of advantage. (Rest., supra, § 1, com. b; California Federal Bank v. Matreyek, supra, 8 Cal. App.4th at p. 131.)
*1663 The fact that one person benefits another is not, by itself, sufficient to require restitution. The person receiving the benefit is required to make restitution only if the circumstances are such that, as between the two individuals, it is unjust for the person to retain it. (Rest., Restitution, supra, § 1, com. c.) For example, a person who improves his or her land usually benefits his or her neighbors to some extent. In that case, however, restitution is not required because it would not be unjust to permit the neighbors to retain the benefit of the landowner's work. (Ibid.)
Determining whether it is unjust for a person to retain a benefit may involve policy considerations. For example, if a person receives a benefit because of another's mistake, policy may dictate that the person making the mistake assume the risk of the error. The desirability of allowing a party to retain the benefit of his or her bargain may preclude the injured party from receiving restitution. Similarly, "a customary way of regarding a particular type of transaction may justify the inference that the payor has assumed the risk of mistake, as in the case of payment for a quitclaim deed to land not owned by the transferor...." (Rest., Restitution, supra, introductory note, p. 28.)
In addition, the same equitable considerations justifying restitution may constitute a defense to a restitution claim. For these reasons, "restitution is commonly denied against an innocent transferee or beneficiary, if he has changed his position after the transaction and it is impossible or impractical to restore him to his original position." (Rest., Restitution, supra, introductory note, p. 28; City of Hope Nat. Medical Center v. Superior Court (1992) 8 Cal. App.4th 633, 637 [10 Cal. Rptr.2d 465].) Likewise, a bona fide purchaser is generally not required to make restitution. (Rest., Restitution, supra, § 13.)
By contrast, a transferee with knowledge of the circumstances giving rise to an unjust enrichment claim may be obligated to make restitution. For example, "A person who has entered into a transaction with another under such circumstances that, because of a mistake, he would be entitled to restitution from the other,... [¶] (b) is entitled to restitution from a third person who had notice of the circumstances before giving value or before receiving title or a legal interest in the subject matter." (Rest., Restitution, supra, § 13.)
Finally, section 168 of the Restatement of Restitution provides, "Where a person holding property in which another has a beneficial interest transfers title to the property in violation of his duty to the other, the transferee holds the property subject to the interest of the other, unless he is a bona fide purchaser."
*1664 The foregoing principles demonstrate that restitution may be required when the person benefitting from another's mistake knew about the mistake and the circumstances surrounding the unjust enrichment. In other words, innocent recipients may be treated differently than those persons who acquire a benefit with knowledge. Accordingly, under restitution law, Sunrise's knowledge, discussed, post, is an important consideration in determining the validity of FNS's unjust enrichment claim.

B. Purchase Money Deed of Trust

We next review secured transactions principles to consider their impact upon FNS's claim for unjust enrichment. According to Sunrise, secured transactions law precludes FNS's cause of action. As we shall explain, we disagree.
(4) "In California, as in most states, a creditor's right to enforce a debt secured by a mortgage or deed of trust on real property is restricted by statute. Under California law, `the creditor must rely upon his security before enforcing the debt. (Code Civ. Proc., §§ 580a, 725a, 726.) [Fn.] If the security is insufficient, his right to a judgment against the debtor for the deficiency may be limited or barred by sections 580a, 580b, 580d, or 726 of the Code of Civil Procedure.' [Citation.]" (Guild Mortgage Co. v. Heller (1987) 193 Cal. App.3d 1505, 1510 [239 Cal. Rptr. 59]; see also Rettner v. Shepherd (1991) 231 Cal. App.3d 943, 949 [282 Cal. Rptr. 687].)
A "`deficiency judgment' is a personal judgment against the debtor for the difference between the debt and the proceeds received by the creditor from the sale of the security at a ... foreclosure sale. [Citation.]" (Coppola v. Superior Court (1989) 211 Cal. App.3d 848, 866 [259 Cal. Rptr. 811].)
(5) Because this case concerns a purchase money deed of trust, no deficiency judgment would be allowed. (Code Civ. Proc., § 580b.) In other words, FNS could not recover the difference between the debt and the sale proceeds if the property had been foreclosed. According to Sunrise, this same rule prevents FNS from stating a claim for unjust enrichment. Sunrise argues that permitting recovery for unjust enrichment would be the same as permitting a deficiency judgment.
There are two problems with Sunrise's argument. First, permitting recovery for unjust enrichment and recovering a deficiency judgment are not the same. In this case, the difference between the debt and the foreclosure proceeds is not at stake; there can be no foreclosure because the lien on the property has been extinguished. Moreover, allowing recovery for unjust *1665 enrichment would not contradict the policy of requiring the creditor to rely upon the property to secure the debt. This is because any unjust enrichment recovery could not exceed the property value. Thus, if the property value had decreased, and was less than the debt, a plaintiff's unjust enrichment recovery would be limited by the value of the property.
Second, an unjust enrichment claim is based upon equitable principles. These equitable principles may outweigh the reasons for prohibiting deficiency judgments. In fact, in other situations equitable considerations cause the prohibition against deficiency judgments to give way. Bad faith waste is an example. A nonassuming grantee of a purchase money deed of trust would be liable for bad faith waste to the property. (Cornelison v. Kornbluth (1975) 15 Cal.3d 590, 604 [125 Cal. Rptr. 557, 542 P.2d 981].) This is so even though the grantee would not be liable for any deficiency judgment upon a purchase money deed of trust. By parity of reasoning, we believe that in appropriate circumstances an action for unjust enrichment could be stated against a nonassuming grantee under a purchase money deed of trust.
Sunrise attacks this result by arguing that it would permit parties to obtain deficiency judgments by trickery. In particular, Sunrise claims a beneficiary under a purchase money deed of trust could simply release its security (rather than resort to it) and then sue a solvent successor for unjust enrichment.
We disagree. A beneficiary would not gain anything in Sunrise's scenario. As previously stated, an unjust enrichment recovery is not the same as a deficiency judgment. Whether through foreclosure or an unjust enrichment cause of action, the beneficiary's recovery would be limited to the amount of the debt covered by the value of the property. Assume the debt was $50,000, and the property value decreased from $60,000 to $40,000. If the trustee mistakenly reconveyed the deed of trust, and the grantee sold the property and received $40,000, the beneficiary could recover only $40,000, albeit through an unjust enrichment cause of action or foreclosure. No deficiency would be allowed.
In addition, it is settled that the one-action rule would prevent an unjust enrichment recovery in the circumstances envisioned by Sunrise. "Although an exception to the one-action rule has developed in cases where foreclosure would be an idle act because the security has been destroyed or become worthless [citations], the exception does not apply if the beneficiary himself is responsible for the loss of security. Thus a creditor is not allowed to circumvent the statute by divesting himself of his security without the consent of the debtor." (Pacific Valley Bank v. Schwenke (1987) 189 Cal. App.3d 134, 140 [234 Cal. Rptr. 298].)


*1666 C. Case Law

We have examined principles relating to restitution and secured transactions law. We will now consider case authority to determine whether FNS may state a claim for unjust enrichment. Although we have not found a case precisely on point, the cases included below should assist our analysis.
In California Federal Bank v. Matreyek, supra, 8 Cal. App.4th 125, the bank assigned the borrowers' loan to Fannie Mae.[1] The bank continued servicing the loan. The borrowers asked the bank if they could refinance and pay off the loan without a prepayment penalty. Although the bank advised them that they could, this advice was incorrect. (Id. at p. 128.)
After the borrowers paid off the principal and accrued interest, the bank cancelled the note and reconveyed the deed of trust. The bank then discovered the prepayment penalty should have been assessed. Because of the error, the bank had to pay Fannie Mae $653,998.74. Although the bank asked the borrowers for reimbursement, the borrowers refused. The bank then sued the borrowers for unjust enrichment, and equitable subrogation. The borrowers' demurrer was sustained without leave to amend and a judgment of dismissal was entered. (California Federal Bank v. Matreyek, supra, 8 Cal. App.4th at p. 129.)
The appellate court affirmed. In rejecting the bank's unjust enrichment claim, the court relied upon restitution principles. The court noted that a party who does not know about another's mistake, and has no reason to suspect it, is not necessarily required to give up the benefit received. The court decided that the pivotal issue was whether permitting the borrowers to retain the benefit would be unjust. In concluding that it would not, the court first emphasized that the borrowers gave consideration (paying the loan early) in exchange for the bank's agreement to forgo the prepayment penalty. (California Federal Bank v. Matreyek, supra, 8 Cal. App.4th at p. 133.) Second, the court pointed out that waiver of the prepayment penalty was critical in the borrowers' early payment decision. Third, the court reasoned that there was no impropriety by the borrowers. It emphasized that the bank did not allege that the borrowers knew of the mistake or took unfair advantage. (Ibid.)
Finally, the court pointed out that "in repaying the loan early, the [the borrowers] entered into substitute financing.... If [the bank] were to recover the claimed sum from [the borrowers], that sum would erase any benefit to [the borrowers] from the refinancing, while [the bank] and/or *1667 Fannie Mae still would retain the benefit of an early payoff of the ... loan. Under the circumstances, recovery by [the bank] would be inequitable." (California Federal Bank v. Matreyek, supra, 8 Cal. App.4th at p. 134.)
California Federal is distinguishable from our case. First, in California Federal, the plaintiff made the mistake. By contrast, in this case, the trustee was responsible for the mistake. Second, in California Federal, the borrowers did not know about the mistake. In our case, as we shall explain later, Sunrise knew or should have known that it was not entitled to all of the proceeds from the sale of the property. Finally, in California Federal, the recipient of the benefit gave consideration in exchange for obtaining the advantage. In the circumstances here, no such consideration was given.
Also assisting our analysis is Firato v. Tuttle (1957) 48 Cal.2d 136 [308 P.2d 333]. In that case, a purchase money deed of trust was mistakenly reconveyed by the trustee. The trustee was authorized to reconvey only if the loan was paid in full. After the property had been sold several times, the beneficiaries filed suit. The beneficiaries never alleged that the subsequent purchasers knew about the error or were not bona fide purchasers. (Id. at p. 138.) The court found this persuasive.
The Firato court also relied upon former section 2243 of the Civil Code which stated "`Everyone to whom property is transferred in violation of a trust, holds the same as an involuntary trustee under such trust, unless he purchased it in good faith and for a valuable consideration.'" (Firato v. Tuttle, supra, 48 Cal.2d at p. 139, italics omitted.) Reasoning that such rules are consistent with equitable principles and the "convenient transaction of business," the court affirmed the trial court's sustaining of the demurrer to the beneficiaries' complaint. (Ibid.)
Restitution was denied in City of Hope Nat. Medical Center v. Superior Court, supra, 8 Cal. App.4th 633. In that case, the insurer paid the hospital for health care given to the insured. The insurer later decided the insured's treatment was not covered by the insured's policy. It sued the hospital for reimbursement, seeking restitution of the money paid. In determining that the hospital was not required to reimburse the insurer, the court emphasized that "[r]estitution will be denied, however, if the mistaken payment is made to a bona fide creditor of a third person  a creditor without fault because it made no misrepresentations to the payor and because it had no notice of the payor's mistake at the time payment was made.... Stated plainly, if it's your mistake, you get to pay for it  unless the recipient misled you or accepted the payment knowing you didn't owe it." (Id. at p. 637, italics added.)
*1668 Other cases also suggest that a person's notice of the circumstances giving rise to unjust enrichment affects that person's obligation to make restitution. In Phelps v. American Mtg. Co. (1936) 6 Cal.2d 604 [59 P.2d 95], the court concluded, "`[i]n equity, a release, unauthorized by the terms of the trust or by the cestui que trust, will have no effect upon the deed of trust as between the original parties or as to subsequent purchasers with notice.'" (Id. at p. 608, latter italics added.)
In Duley v. Westinghouse Electric Corp. (1979) 97 Cal. App.3d 430 [158 Cal. Rptr. 668], seller sold property to buyer in exchange for a promissory note secured by a deed of trust on the property. A judgment lien was subsequently placed on the property. Seller's trust deed was mistakenly reconveyed. Seller sued to cancel the reconveyance and establish the priority of his deed of trust. The court reasoned, "The only legal and equitable solution in the situation ... is cancellation of the reconveyance, returning the parties to their status quo. The court may cancel a written instrument where there is a reasonable likelihood, if left outstanding, it may seriously injure a person against whom it is void or voidable.... Allowing the reconveyance to stand would leave [seller] without security for his loan and create an inequitable windfall for [judgment lienor], as its abstract of judgment would take priority in any sale of the property." (Id. at p. 432.)
Sunrise relies upon Griffith Co. v. Hofues (1962) 201 Cal. App.2d 502 [19 Cal. Rptr. 900]; Truestone, Inc. v. Simi West Industrial Park II (1984) 163 Cal. App.3d 715 [209 Cal. Rptr. 757]; Nibbi Brothers, Inc. v. Home Federal Sav. & Loan Assn. (1988) 205 Cal. App.3d 1415 [253 Cal. Rptr. 289]; and Pacific Valley Bank v. Schwenke, supra, 189 Cal. App.3d 134.
These cases differ sharply from the circumstances here. In Griffith Co. v. Hofues, supra, 201 Cal. App.2d 502, the recipient of the benefit was not in a position to have refused the advantage. In addition, the plaintiff invited the circumstances leading to the unjust enrichment.
Truestone, Inc. v. Simi West Industrial Park II, supra, 163 Cal. App.3d 715, concerned a subcontractor's attempt to recover directly from a property owner. No issue of mistake was involved. In Nibbi Brothers, Inc. v. Home Federal Sav. & Loan Assn., supra, 205 Cal. App.3d 1415, no unjust enrichment claim was presented. This was because the alleged misrepresentation which led to the enrichment was merely a nonactionable expression of opinion. (Id. at p. 1423.) Finally, in Pacific Valley Bank v. Schwenke, supra, 189 Cal. App.3d 134, no mistaken reconveyance or unjust enrichment cause of action was at stake.


*1669 D. Sunrise's Knowledge

(6) Our review of the authorities discloses that Sunrise's knowledge is critical to the validity of FNS's unjust enrichment claim. If Sunrise should not have known about the reconveyance, and should not have realized that it was not entitled to all of the sale proceeds, then it would not necessarily be unjust to permit it to retain those proceeds. On the other hand, if Sunrise did know that it was not entitled to all of the sale proceeds, then it is fair to require that Sunrise make restitution.
Surprisingly enough, FNS's second amended complaint does not allege Sunrise's knowledge. It does not state that Sunrise knew about the improper reconveyance. Nor does the complaint allege that Sunrise realized that it was not entitled to all of the proceeds from the sale of the property. In any event, we do not believe Sunrise could not have known that it was not entitled to all of the sale proceeds. Furthermore, it is interesting to note that Sunrise clearly had notice of the reconveyance. The deed of reconveyance indicates it was mailed to David Perry, Sunrise's trustee.
Neither are we persuaded by Sunrise's arguments against FNS's recovery. Sunrise stresses that unjust enrichment recovery would be contrary to secured transactions law and restitution law. As we have already explained, this is incorrect. More importantly, nowhere does Sunrise explain why it should be entitled to all of the proceeds from the sale. Sunrise focuses upon the future consequence of allowing recovery. Given the facts of this case, Sunrise does not, and cannot, explain why it should be entitled to this windfall.
Sunrise also argues that FNS should file suit against the trustee responsible for the reconveyance. To counter this allegation, FNS relies upon a hypothetical: "If a bag of money falls out of the back of an armored car because of a defective lock, the armored car company is not first required to sue the locksmith before seeking to recover the money from its finder."
Sunrise also suggests that FNS should have tried to cancel the reconveyance. However, in this case, the property was sold to bona fide purchasers approximately six months after the trustee's mistake. For this reason, it is too late to cancel the reconveyance. Moreover, since only six months passed between the time of the reconveyance and the sale, we do not believe that laches can constitute a defense to FNS's unjust enrichment action.
In sum, we believe that FNS should be given an opportunity to amend its complaint to allege Sunrise's knowledge of the improper reconveyance, as *1670 well as Sunrise's knowledge that it was not entitled to all of the proceeds from the sale of the property. With this amendment, FNS can state a claim for unjust enrichment.

II. Statute of Frauds

(7) Sunrise argues that FNS's complaint is barred by the statute of frauds. In particular, it alleges that FNS's unjust enrichment cause of action is merely a de facto "assumption" agreement which is barred by Civil Code section 1624, subdivision (f).[2] We disagree. The right to restitution or quasi-contractual recovery is based upon unjust enrichment. "The statute of frauds applies to true contracts only." (1 Witkin, Summary of Cal. Law (9th ed. 1987) Contracts, § 92, p. 123; Mayborne v. Citizens T. & S. Bank (1920) 46 Cal. App. 178, 190 [188 P. 1034]; Peterson Tractor Co. v. Orlando's Snack-Mobile Corp. (1969) 270 Cal. App.2d 787, 791 [76 Cal. Rptr. 221].) Because this is not an action upon a contract, nor a subterfuge for one, the statute of frauds is not a bar to FNS's recovery.

III. Statute of Limitations

(8) Sunrise argues that the statute of limitations precludes FNS's claim. "A quasi-contract action, in the form of a common count for money had and received, to recover money obtained by fraud (waiver of tort) or mistake, is governed by the fraud statute." (3 Witkin, Cal. Procedure (3d ed. 1985) Actions, § 451, p. 482; Shain v. Sresovich (1894) 104 Cal. 402 [38 P. 51].)
The windfall occurred on December 17, 1986. This was the date when Sunrise sold the property to the Sundbergs. The first amended complaint, naming Sunrise as a defendant, was filed December 11, 1989. Thus, the complaint was filed less than three years from the date the cause of action accrued. Accordingly, FNS's unjust enrichment claim is not barred by the statute of limitations.

Conclusion
"For every wrong there is a remedy." (Civ. Code, § 3523.) "Where one of two innocent persons must suffer by the act of a third, he, by whose negligence it happened, must be the sufferer." (Civ. Code, § 3543.) In this case, FNS, through no fault of its own, lost its security in Sunrise's property. *1671 Sunrise had no legitimate claim to this previously secured portion of the property, and arguably knew or should have known it did not own all of the property. Nonetheless, it sold the property and pocketed all of the proceeds. Given these circumstances, this may prove to be a classic case of unjust enrichment.
The judgment is reversed. Costs on appeal to FNS.[3]
Cottle, Acting P.J., and Premo, J., concurred.
NOTES
[1]  Federal National Mortgage Association.
[2]  Civil Code section 1624, subdivision (f), requires that the following type of contract be in writing, "(f) An agreement by a purchaser of real property to pay an indebtedness secured by a mortgage or deed of trust upon the property purchased, unless assumption of the indebtedness by the purchaser is specifically provided for in the conveyance of the property."
[3]  Because we conclude that FNS can state an unjust enrichment claim, we need not consider FNS's argument regarding the trial court's statement of decision. In addition, we find no abuse of discretion in the trial court's decision to deny Sunrise attorney's fees. Finally, given the result we reach, Sunrise is obviously not entitled to attorney's fees on appeal.
