This is a suit in equity arising out of substantially the following facts:
D. L. Lindsey executed contemporaneously two mortgages on a certain tract of land, the one to secure a note given for $1,200 to G-eorge Emlett for the purchase money for said tract of land, and the other for $1,000 to secure a debt due plaintiff. It appears directly and inferentially from the evidence that Lindsey made default in the payment of the Emlett mortgage debt when the same became due, and that he made an application to the International Loan & Trust Company, who was made a defendant in the suit for a loan on the land to enable him to pay Emlett’s mortgage, but experienced some difficulty in consequence of the existence of the plaintiff’s second mortgage. In order to remove this impediment the plaintiff, who was the sister of Lindsey, was asked to release her mortgage. This she declined to do. Emlett then advertised the land under his mortgage and sold the same to- W. A. Lindsey, a son of the mortgagor. Nothing was paid by W. A. Lindsey on his purchase. He conveyed the land to D. L. Lindsey, the mortgagor. The latter thereupon negotiated a loan from the loan and trust company on the land for $1,200. It seems that D. L. Lindsey and *477the loan and trust company believed that the sale made of the land by Emlett to W. A. Lindsey passed the title to the latter and cut out the second mortgage of the plaintiff.
It further appears that the loan and trust company, out of the $1,200 so loaned, paid to Emlett $891.03, the amount of the bid made by W. A. Lindsey for the land, and also paid $22.39 taxes due on the land. This being done the deed was made by Emlett to W. A. Lindsey for the land, and the said D. L. Lindsey executed the mortgage to the loan and trust company on the land to secure the $1,200 loan so made. The object of the plaintiff’s suit is to have her second mortgage declared a first lien on the land and the-circuit court so decreed. To reverse this decree this appeal is prosecuted.
It is conceded that the Emlett mortgage was a prior lien on the land to that of plaintiff. And it might as well, too, be conceded that as between the plaintiff and the mortgagor the purchase by W. A. Lindsey at the sale made by Emlett under his mortgage did not have the effect to pass an unincumbered legal title to the land, or which is the same thing to cut out the plaintiff’s second mortgage lien. Plum v. Studebaker, 89 Mo. 165; 2 Jones on Mortgages [3 Ed.] sec. 1887; 2 Pomeroy on Equity, sec. 728. Since W. A. Lindsey no doubt bid in the land for D. L. Lindsey to whom he undertook to convey it, and since there was nothing paid by W. A. Lindsey on his bid, nor was there anything paid by D. L. Lindsey to W. A. Lindsey as a consideration for the said conveyance by the-latter to the former, we are unable to discover that the case is different than if D. L. Lindsey had himself directly bid in the land at the sale made by Emlett.
If W. A. Lindsey had bid in the land, paid the amount' of his bid and had received a deed from *478Emlett, he would still not have acquired the unincumbered legal title, but would have been the owner only of an equity of redemption in the land. In that case the plaintiff’s second mortgage lien would have been advanced to the'place of a first mortgage. If the value of the land was in excess of the second mortgage, then to the extent of such excess would the mortgagor’s eqitity of redemption have been enhanced, but, beyond this and the payment of the first mortgage debt for which he was bound, his position was not altered. If the land was of no greater value than the amount of the second mortgage, as seems was the case, then all that the mortgagor accomplished by his purchase was the discharge of his first mortgage debt.
This brings us face to face with what seems to us to be the paramount question in this case, that is to say, whether the loan and trust company under the agreement with the mortgagor, having paid to Emlett the amount of the bid of W. A. Lindsey for the land and the taxes thereon, is in consequence of that entitled in equity to be subrogated to the rights of Emlett, the mortgagee, and to take precedence over the second mortgage lien to the extent of the amount so paid by it. Undoubtedly Emlett, the mortgagee, supposed that in 'making the foreclosure sale that he was selling the fee. It is equally clear that the purchasing mortgagor supposed that it was the fee that he was purchasing. No other conclusion can be fairly drawn from the evidence. His evident purpose was to secure in himself the title in fee so that he could obtain the desired loan to pay Emlett’s mortgage debt. He first endeavored to induce the plaintiff to release her mortgage, and, failing in that, a foreclosure sale was made to enable him thereby to accomplish that end. The manner in which the foreclosure sale was conducted, the execution of the mortgagee’s deed to W. A. *479Lindsey, and other facts all tend to lend support to the inference that it was the intention of all the parties to the mortgage to so conduct the transaction as to enable the mortgagor to acquire the unincumbered title to the land, so that he would be enabled to procure the desired loan thereon of the loan and trust company. Not only this, but the loan and trust company supposed that the foreclosure sale had passed the fee to the mortgagor, or else it would not have made the loan that it did to him on the land. It had the land appraised, and it is to be inferred that the valuation fixed on the land was less, or, at least, not in excess of the loan; for, if so, why was a personal guaranty taken for the payment of $300 of the amount loaned?
It thus appears that these elements constitute a case of mixed and mutual mistake of law and fact. Griffith v. Townley, 69 Mo. 13. It manifestly would be highly inequitable to permit the plaintiff to profit so largely by this mistake. The payment by the loan and trust company of the amount bid at the foreclosure sale, according to the decree, gave it no right or interest either in the land, or the purchase money mortgage. But plaintiff’s security from being of no value was thereby enhanced in value to the amount of her debt. It is true that in this view of the case the first mortgagee was paid his debt, but the loan and trust company making the payment must content itself with a second mortgage security without any value. It is thus made to appear that the case is one warranting equitable relief.
The doctrine of subrogation rests on the basis of mere equity or benevolence. It is resorted to for the purpose of doing justice between the parties. The subrogation by operation of law to the rights and interests of the mortgagor in the land is on and by redemption; and redemption is payment of the mortgage debt after *480forfeiture by the terms of the mortgage contract; so that really the subrogation by operation of law arises or proceeds on the theory that the mortgage debt is paid.
Under the equitable principle of subrogation one, who pays a mortgage debt under an agreement for an assignment or for a new mortgage for his own benefit or protection, acquires a right to the security held by the other. Jones on Mortgages, sec. 874; 1 Leading Cases in Equity, 154; Homeopathic Ins. Co. v. Marshall, 32 N. J. Eq. 103; Denton v. Col., 30 N. J. Eq. 244; Salyn v. Knox, 41 Mich. 40; Sevy v. Martin, 48 Wis. 198; Barnes v. Mott, 64 N. Y. 397. So it has been adjudged that in a case where one pays the debt of another at the debtor’s instance that equity will subrogate him to the rights of the creditors. Norton v. Highleyman, 88 Mo. 621; Williams v. Perkins, 83 Mo. 376; Wilson v. Brown, 13 N. J. Eq. 277; Richmond v. Morrison, 15 Ind. 134; Hough v. Ins. Co., 57 Ill. 319; Sanford v. McLow, 3 Paige, 117; Wolf v. Walter, 56 Mo. 292; Hoy v. Brambal, 4 C. E. Greene (N. J.) 563; Pierson v. Anderson, 4 Edwards Ch. 17; Pelz v. Clark, 5 Peters (U. S.) 482; Carter v. Taylor, 3 Head, 30.
So too it has been held that when a purchaser at a foreclosure sale supposing he had acquired good title sold the land to another by warranty deed, the mortgagor having recovered the land on account of irregularities in the foreclosure sale, the purchaser was sued upon his covenant of warranty and was obliged to pay the value of it. But he was declared entitled to be subrogated to the rights of the mortgagor as an equitable assignee. Gatewood v. Gatewood, 75 Va. 407. And so too it has been further held in this state that when by reason of the irregularity in the proceedings to foreclose a mortgage the title did not pass to the purchaser at the foreclosure sale that such purchaser ought to be *481subrogated to the rights of the mortgagee by virtue of the payment of the mortgage debt, and that in such case the purchaser does not occupy the relation of stranger to the mortgage. Hornaker v. Shough, 55 Mo. 472; Jones v. Mack, 53 Mo. 147. And in another case where a sale under a mortgage failed to carry the legal title to the land it was held that it operated to vest the equitable title to the mortgage in the purchaser. Wilcoxon v. Osborne, 77 Mo. 621.
In view of the principles to which we have already adverted we are of the opinion that the loan and trust company is entitled to be subrogated to the rights of Emlett under his prior mortgage to the extent of the amount advanced by it in payment of the amount of the bid by W. A. Lindsey at the foreclosure sale and the taxes paid by it. It results that the decree of the circuit court will be reversed and the cause remanded with directions to order, adjudge and decree that the said International Loan & Trust Company be substituted and subrogated in said Emlett’s first mortgage to his rights therein to the extent indicated in the foregoing opinion, and to make the usual order for the foreclosure of said mortgage lien and the sale of the said real estate thereunder.
All concur.