
68 Cal.2d 611 (1968)
AMERICAN SAVINGS AND LOAN ASSOCIATION, Plaintiff and Appellant,
v.
MARTIN N. LEEDS, Defendant and Respondent.
L.A. No. 29434. 
Supreme Court of California. In Bank.  
May 27, 1968.
 A. Joseph Sherwood and Richard D. Dreyfus for Plaintiff and Appellant.
 Bolton, Groff & Dunne and Gene E. Groff for Defendant and Respondent.
 TRAYNOR, C. J.
 Plaintiff appeals from a judgment of dismissal as to defendant Martin N. Leeds after his demurrer to the second amended complaint was sustained without leave to amend.
 In its second amended complaint, plaintiff sought to state separate causes of action against defendants Mr. and Mrs. Sheridan and defendants Mr. and Mrs. Leeds. In its first cause of action it alleged that in 1962 the Sheridans sold their home to the Leeds for $122,500. The Leeds borrowed $85,000 of the purchase price from plaintiff, giving their note secured by a first deed of trust. The Sheridans knew that their house and other improvements were built on improperly filled and compacted soil, the subsidence of which had caused cracking and separating of various parts of the house and other improvements. Before the sale the Sheridans concealed and camouflaged these defects by painting, plastering, and decorating, and when plaintiff's agent inspected the property to determine whether it was suitable security, the Sheridans falsely represented that the house was built on unfilled land. In reliance on these representations plaintiff lent the Leeds $85,000, which was paid to the Sheridans on the close of escrow. Owing to the soil condition, the property was of little or no value and would not qualify as security for a loan, and *613 after the sale further subsidence caused the house to become unihabitable and the security became "worthless or of little or no value."plaintiff sought to recover general damages of $85,000 plus interest and punitive damages of $50,000 from the Sheridans.
 In its second cause of action plaintiff incorporated the allegations of the first. It also set forth the deed of trust executed by the Leeds and alleged that the Leeds had sued the Sheridans for damages caused by the condition of the property and settled their action for an amount unknown to plaintiff.plaintiff sought to hold the Leeds liable for its entire alleged loss of $85,000 on the theory that the Leeds' failure to keep the property in good condition and repair destroyed plaintiff's security. It also sought to impose a trust in its favor on the amount the Leeds received in settlement from the Sheridans.
 Although Mrs. Leeds was named as a party defendant, it does not appear whether she was served or appeared. From the file in the action by the Leeds against the Sheridans, which was incorporated by reference in plaintiff's complaint, it appears that the Leeds are divorced and that, pursuant to a property settlement, Mrs. Leeds quitclaimed her interest in the property involved to Mr. Leeds and assigned to him her interest in the Leeds action against the Sheridans. Accordingly, Mr. Leeds appeared individually in this action. After his demurrer was sustained without leave to amend, the action was dismissed as to him. We will hereafter refer to him as defendant.
 Plaintiff invokes two provisions of the deed of trust to establish defendant's liability. "To Protect the Security of This Deed of Trust," defendant agreed "(1) To keep said property in good condition and repair, not remove or demolish any buildings thereon; [and] to complete or restore promptly and in good and workmanlike manner any building which may be constructed, damaged or destroyed thereon. ..." He also agreed that "(9) Any award of damages in connection with any condemnation for public use of or injury to said property or any part thereof is hereby assigned and shall be paid to Beneficiary [plaintiff] who may apply or release such moneys received by [it] in the same manner and with the same effect as above provided for disposition of proceeds from fire or other insurance."
 It is unnecessary to decide whether the one-form-of-action *614 provision of section 726, Code of Civil Procedure  [fn. 1] or an analogous common law rule precludes enforcing either of these provisions except as incident to a foreclosure (see Lavenson v. Standard Soap Co. (1889) 80 Cal. 245, 247-248 [22 P. 184, 13 Am.St.Rep. 147]; Reed Orchard Co. v. Superior Court (1912) 19 Cal.App. 648, 665 [128 P. 9, 18]; Rose v. Conlin (1921) 52 Cal.App. 225, 231 [198 P. 653]; Osborne, Mortgages (1951)  128, p. 319,  136, p. 334; cf. Mills v. Brown (1928) 205 Cal. 38, 40 [269 P. 636]), or upon pleading and proof that the security is valueless. (See Roseleaf Corp. v. Chierighino (1963) 59 Cal.2d 35, 39 [27 Cal.Rptr. 873, 378 P.2d 97] and cases cited.) Neither of the provisions of the deed of trust invoked by plaintiff is applicable to the facts pleaded.
 [1a] The damage to the property did not result from any act of defendant or others occurring after the sale.  [fn. 2] It was *615 caused by the failure properly to compact the fill before the house and improvements were constructed. As a result the property was worth substantially less at the time of the sale than plaintiff and defendant believed it to be worth. Each was damaged by the fraud of the vendors, plaintiff by lending money on the basis of inadequate security and defendant by paying the remainder of the purchase price. Neither plaintiff nor defendant may properly shift his loss to the other.
 Even if defendant's agreement to "keep said property in good condition and repair" and to "restore ... any building which may be ... damaged or destroyed thereon" could reasonably be interpreted to include an obligation to correct the improper fill condition and repair all physical damage caused thereby, section 580b  [fn. 3] of the Code of Civil Procedure would preclude giving effect to that interpretation. [2] Section 580b prohibits any deficiency judgment after the sale of property under a purchase money mortgage or deed of trust and places the full risk of inadequate security on the purchase money lender. (Bargioni v. Hill (1963) 59 Cal.2d 121, 123 [28 Cal.Rptr. 321, 378 P.2d 593]; Roseleaf v. Chierighino, supra, 59 Cal.2d 35, 42; Brown v. Jensen (1953) 41 Cal.2d 193, 197-198 [259 P.2d 425].) To require defendant to correct the condition of the property existing at the time of the sale and to repair the damage to the improvements caused by that condition would shift to him one of the risks that section 580b requires plaintiff to bear.
 [1b] Clause (9) of the deed of trust refers to any "award of damages in connection with any condemnation for public use of or injury to" the property and is arguably limited to *616 condemnation awards for taking or damaging property. Even if it also includes an award for physical damages to property inflicted by a private tortfeasor, it does not include the settlement defendant made with the Sheridans as vendors. Defendant's action against the Sheridans was not for injury to the property but for the Sheridans' fraudulent or negligent wrong in inducing defendant to purchase the property. By the time of the sale, the improper compacting of the fill had already manifested itself by causing physical injury to the property. In his action against the Sheridans, defendant sought damages or rescission on theories of fraudulent misrepresentations, fraudulent concealment, negligent misrepresentations, and negligent construction. We do not know which, if any, of these bases for imposing a duty on the Sheridans defendant might have established had the case gone to trial. It is clear, however, that the gravaman of his action was to recover, not damages for physical injury to the property, but the economic loss he suffered by being induced to buy property that was worth substantially less than the purchase price. Recovery for such a personal loss to defendant as vendee is not one for damages for injury to the property that plaintiff may claim as a substitute for its security.
 Plaintiff points out, however, that defendant sued the Sheridans not only for his own damages but to recover the full purchase price of the property. It therefore contends that the settlement must be deemed to include plaintiff's loss and be subject to the lien of its deed of trust. We have no doubt that had the Sheridans settled with and paid to defendant the full purchase price of the property, plaintiff would be entitled to impose a constructive trust to the extent of its debt on that settlement. Even though such a settlement would not have been binding on plaintiff in its own action against the Sheridans, it would reflect an intention of the Sheridans to correct any wrong they might have committed in the sale of the property. It could not be assumed that in paying full damages to defendant they intended other than a complete settlement. In such case plaintiff could properly claim recompense on the theory that the Sheridans had mistakenly paid money to defendant that properly should have been paid to plaintiff. (Civ. Code,  2224, 3521, 3529; Rest., Restitution,  160; Ward v. Taggart (1959) 51 Cal.2d 736, 741-743 [336 P.2d 534].)
 At no time, however, has plaintiff alleged that defendant received more in settlement from the Sheridans than his own *617 damages.  [fn. 4] In sustaining demurrers to plaintiff's complaints, the trial court pointed out that plaintiff was seeking to reach a settlement that appeared to be personal to defendant, and only after plaintiff's third attempt to state a cause of action against defendant, did the court sustain the demurrer without leave to amend. No abuse of discretion appears, and the court correctly concluded that plaintiff had failed to state a cause of action against defendant.
 The judgment is affirmed.
 McComb, J., Peters, J., Tobriner, J., Burke, J., and Sullivan, J., concurred.
 MOSK, J.
 I dissent.
 This is not a suit upon a secured debt, but a suit to prevent security from being impaired. (Mills v. Brown (1928) 205 Cal. 38 [269 P. 636].) The deed of trust signed by the defendant provided he was "to protect the security." Specifically he agreed "(1) To keep said property in good condition and repair, ... to complete or restore promptly and in good and workmanlike manner any building which may be constructed, damaged or destroyed thereon. ..." (Italics added.)
 To permit the defendant to appropriate to his own use a cash fund a part or all of which he received because third parties "constructed, damaged or destroyed" the building which constituted the security does violence to the intent of the foregoing trust deed provision. The defendant had a clear duty to restore promptly the building to good condition. Since he received funds and has failed to use them for the agreed purpose, it is not inappropriate to impress the funds with a lien or trust (Civ. Code,  2224).
 It is true that we do not now know, nor does plaintiff, how much of the settlement between defendant and the Sheridans was attributable to damage to the security property and how much was for the Sheridans' tortious conduct in the nature of fraud and deceit. But it must be remembered that this case was decided at the pleading stage. The plaintiff alleged that defendant sued the Sheridans for damage to the land and improvements and subsequently settled the claim; the demurrer admits the allegations. Despite this admission that defendant *618 received money for damage to the security, the plaintiff was not permitted to maintain his prima facie cause of action and then to ascertain, through defendant's answer, discovery and ultimate trial, the precise nature of the settlement.
 The court below apparently examined the complaint in the defendant's suit against the Sheridans and concluded that it sounded exclusively in tort. However, the court failed to consider the pretrial contentions, in which defendant demanded of the Sheridans not merely the sums he had himself expended, but the full purchase price of $122,500, including the $85,000 borrowed from plaintiff company. As to the $85,000 or any part thereof ultimately recovered, it seems irrefutably clear that the defendant would necessarily be a constructive trustee for plaintiff. The Sheridans in their pretrial statement maintained that the $85,000 loan be excluded from the damage claim against them. In that manner the issues were joined and subsequently settled.
 Nevertheless the defendant has insisted that his action against the Sheridans was merely for a personal tort and unrelated to property damage to the security. I find it of particular relevance that the defendant sought as damages in his prayer in that prior lawsuit the exact amount of the purchase price. It would be a remarkable coincidence if damage for fraud and deceit he purportedly suffered equalled to the penny the value of the security property. Thus even beyond the technical admission of facts alleged in the complaint which a demurrer is deemed to be, a conclusion is inescapable that some part of the defendant's settlement with the Sheridans was attributable to damage to the security property. In that event, as stated in Los Angeles Trust & Sav. Bank v. Bortenstein (1920) 47 Cal.App. 421, 424 [190 P. 850], the money "takes the place of the reduced value of the land" and is subject to a constructive trust.
 Although the majority hint some future action might lie, for the present they permit the defendant to effectively escape his responsibility to the plaintiff to keep the security intact, and they allow him to retain the entire fund received from the third parties some part of which was obtained because of damage to the security. This is unjust enrichment.
 The complaint stated a cause of action. It was error to sustain the demurrer without leave to amend. I would reverse the judgment.
 The theory upon which all these remedies rest is one of equitable conversion or substituted property: "[T]he money so awarded by the court as damages to the realty must be treated, in equity, as the land itself. It takes the place of the reduced value of the land. The mortgaged land, in its present damaged condition, together with such portion of all the moneys awarded for the total injury as represents the damage to the mortgaged premises, stand now in the place and stead of the original uninjured mortgaged premises." (Los Angeles Trust & Sav. Bank v. Bortenstein, supra, 47 Cal.App. 421, 424.)
 If plaintiff were attempting to reach substitute property, it could do so without being barred by section 580b of the Code of Civil Procedure. (See fn. 3, infra.) That section prohibits a deficiency judgment when a mortgage or deed of trust secures the payment of purchase money on real property, but it does not prohibit mortgagees from preventing mortgagors or third parties from physically harming the security or from recovering damages for such harm. Such a recovery is not a deficiency judgment. (Los Angeles Trust & Sav. Bank v. Bortenstein, supra, 47 Cal.App. 421, 424.) Since the purchase money lender is confined to his security, it is all the more important that he be allowed effectively to protect it.
NOTES
[fn. 1]  1. "There can be but one form of action for the recovery of any debt, or the enforcement of any right secured by mortgage upon real property, which action must be in accordance with the provisions of this chapter."
[fn. 2]  2. Plaintiff's authorities deal primarily with such distinguishable wrongs. Since "The most important single aspect of a mortgage relationship is the subjection of the mortgaged premises to sale and the application of the proceeds of such sale to the satisfaction of the underlying obligation" (3 Powell (Rohan ed. 1967) Real Property,  451, p. 613), a mortgagee out of possession has legal remedies to compensate for damages suffered to the security at the hands of others. He may sue the mortgagor for waste. (Civ. Code,  2929; Taubenfeld, Rights and Remedies Other Than Foreclosure, California Land Security and Development (Cont. Ed. Bar, 1960)  3.29; Osborne, Mortgages, supra,  128. 1 Glenn, Mortgages (1943)  34.) He may sue third persons for tortiously damaging the security. (Taubenfeld, op. cit. supra,  3.31; Los Angeles Trust & Sav. Bank v. Bortenstein (1920) 47 Cal.App. 421, 423-425 [190 P. 850]; Osborne, op. cit. supra, sec; 129; Glenn, op. cit. supra,  34.) He may assert rights in the proceeds from eminent domain proceedings that took part of the security. (Taubenfeld, op. cit. supra,  3.33; Sacramento etc. Drainage Dist. v. Truslow (1954) 125 Cal.App.2d 478 [270 P.2d 928, 271 P.2d 930].) When a third person tortiously damages the property, both the mortgagor and mortgagee may sue the third party tortfeasor. If the mortgagor sues first, he may recover the total amount of damage to the property, but the fund recovered is subject to the lien of the mortgagee to the amount that his security has been damaged. (Los Angeles Trust & Sav. Bank v. Bortenstein, supra, 47 Cal.App. 421, 424; Elvins v. Delaware & Atlantic Tel. & Tel. Co. (1899) 63 N.J.L. 243, 245-246 [43 A. 903, 76 Am.St.Rep. 217]; Garrow v. Brooks (1938) 123 N.J. Eq. 138, 140 [196 A 460]; Osborne, op. cit. supra,  133.)
[fn. 3]  3. "No deficiency judgment shall lie in any event after any sale of real property for failure of the purchaser to complete his contract of sale, or under a deed of trust, or mortgage, given to the vendor to secure payment of the balance of the purchase price of real property, or under a deed of trust, or mortgage, on a dwelling for not more than four families given to a lender to secure repayment of a loan which was in fact used to pay all or part of the purchase price of such dwelling occupied, entirely or in part, by the purchaser." (As amended in 1963. The amendment is not relevant in this case.)
[fn. 4]  4. Both defendant and the Sheridans successfully resisted plaintiff's intervention in defendant's suit against the Sheridans. Having thus undertaken to meet plaintiff separately, it seems extremely unlikely that the Sheridans would have exposed themselves to the risk of paying the same damages twice by including in their settlement with defendant any damages that plaintiff might properly claim.
