
59 Cal.2d 121 (1963)
FREDERICK BARGIONI, Plaintiff and Respondent,
v.
FANNY HILL, Defendant and Appellant.
S. F. No. 21225. 
Supreme Court of California. In Bank.  
Feb. 14, 1963.
 Theodore M. Monell for Defendant and Appellant.
 William Berger for Plaintiff and Respondent.
 TRAYNOR, J.
 Defendant purchased a motel and executed a $5,000 note to plaintiff, who had acted as broker in the transaction. The note was secured by a junior trust deed on the motel. Defendant defaulted on the note and plaintiff sued for the balance due, the security having been lost through a private sale under a senior trust deed. The trial court entered judgment for the amount due. Defendant appeals.
 Defendant contends that plaintiff's recovery is barred by section 580d of the Code of Civil Procedure. [1] That section, however, bars recovery only on a note secured by a trust deed or mortgage that has been rendered valueless by a sale under a power of sale contained in the trust deed or mortgage securing the note sued upon. (Roseleaf Corp. v. Chierighino, ante, pp. 35, 43-44 [27 Cal.Rptr. 873, 378 P.2d 97].) Section 580d does not bar a junior lienor, such as plaintiff, whose security has been sold out by a senior lienor.
 [2] Defendant also contends that plaintiff's recovery is barred by section 580b of the Code of Civil Procedure, which provides that no deficiency judgment shall lie after any sale *123 of real property "under a deed of trust, or mortgage, given to secure payment of the balance of the purchase price of real property." This section compels a purchase money mortgagee to assume the risk that the security is inadequate. [3] The purposes are to discourage land sales that are unsound because the land is overvalued and, in the event of a depression in land values, to prevent the aggravation of the downturn that would result if defaulting purchasers lost the land and were burdened with personal liability. (See Roseleaf Corp. v. Chierighino, ante, pp. 35, 42.) [4] These purposes are served by relieving the purchaser of personal liability to any person who finances the purchase and takes as security a trust deed or mortgage on the property purchased, provided the financier intended the loan to be used to pay all or part of the purchase price. (See Riesenfeld, California Legislation Curbing Deficiency Judgments (1960) 48 Cal.L.Rev. 705, 711-715.) The reasoning to the contrary in Peterson v. Wilson, 88 Cal.App.2d 617, 630-631 [199 P.2d 757, 6 A.L.R.2d 258], is disapproved.
 [5] The trial court found that the parties did not intend that plaintiff's commission be part of the purchase price of the motel. This finding is not supported by the evidence.plaintiff was employed by the seller, plaintiff's brother, to act as broker in the sale of the motel, and plaintiff in turn associated another broker. A written agreement of sale was signed by the buyer and seller and both brokers, under which the purchase price was set at $310,000 and the seller was to pay the brokers' commissions, which amounted to $10,000.  [fn. *] Thereafter, however, defendant agreed to pay the brokers' commissions, and the purchase price was correspondingly reduced to $300,000.plaintiff knew that the seller demanded $300,000 net to him from the sale. He also knew that the seller was obligated to pay the brokers' commissions of $10,000, and that the seller had agreed to finance the purchase on these terms. Thus, in accepting defendant's note in payment of the commission, plaintiff extended credit that otherwise would have been extended by the seller. That credit was necessary to the consummation of the sale. The only reasonable inference that can be drawn from this evidence is that plaintiff intended to and did partially finance *124 the purchase. Since his note was secured by a trust deed on the motel, his recovery is barred by section 580b.
 The judgment is reversed.
 Gibson, C. J., Schauer, J., McComb, J., Peters, J., Tobriner, J., and Peek, J., concurred.
NOTES
[fn. *]  *. The associated broker also accepted a $5,000 note from defendant in payment of her commission. That note was paid and is not involved in this case.
