Reed, J.
The property in question is lot six, and the undivided half of lot 5, in block fourteen, in the city of Keokuk. In 1878, one Enos Hardin was the owner of the property. In November of that year, he mortgaged it to Rix, Hale & Co., to secure the sum of $2,400, and in March *709following he gave the same parties a second mortgage to secure the sum of $220. Each of these mortgages provided that, in case the mortgagor failed or neglected to pay any taxes levied on the property, the mortgagees or their assignees might pay the same, and that any amounts thus paid by them should be ádded to the indebtedness secured by the mortgages, and should bear the same rate of interest as the original indebtedness. Hardin neglected to pay the taxes levied on the property for the year 1879, and it was offered for sale by the county treasurer, for the county and state taxes, at the annual sale for delinquent taxes, in October, 1880, and by the collector of city taxes in November of the same year. Rix, Hale & Co. bid in the property at each of these sales, and the certificates in question were issued to them by the county treasurer and the city collector. They subsequently paid the taxes on the property for the years 1880 and 1881, and took receipts therefor. After these payments liad been made, they sold and assigned the notes secured by the mortgage to the defendant, White. They also assigned to him the mortgages and the tax certificates and receipts. White then instituted a suit against Hardin on the notes and mortgages, and obtained judgment against him for the amount of the notes, and for the foreclosure of the mortgages. But the amounts paid out in the purchase of the property at the tax sales and in payment of the subsequent taxes were not included in the judgments. A special execution was issued on the judgment, and plaintiff purchased the property at the sheriff’s sale, and a sheriff’s deed has been executed to him thereunder. After plaintiff obtained the sheriff’s deed to the property, defendant asserted the claim that he had a lien on the property for the amounts paid in the purchase at the tax sales and in the payment of the subsequent taxes, which was not extinguished by the foreclosure proceeding. The relief which plaintiff demands in this action is the cancellation of these certificates, and of the lien claimed thereunder by defendant. The position urged by appellant’s counsel is, not that defend*710ant can acquire a title to the premises under the purchase at the tax sale, but that, having paid the taxes on the property for which it was being sold, as well as those subsequently levied, for the protection of the mortgagor, he is now entitled to have his lien for the amounts so paid established on the premises, and made superior to the interest of plaintiff therein.
That defendant had a lien on the premises for the amounts paid by Bix, Hale & Co., as taxes on the mortgaged premises, cannot be doubted. But his lien in this respect was under the mortgage. It was created by the contract between the mortgagor and the mortgagee, that any sums which should be paid by the latter for such purposes should be added to the indebtedness secured by the mortgages. An ordinary purchaser at tax sale acquires by his purchase the lien on the property of the county and state for the taxes due. But, as Bix, líale & Co. had a contract with Hardin that they should have the security of the mortgage for any amounts which they might pay for taxes on the premises, the law treats their transaction of bidding in the property at the tax sale as a mere payment of the taxes, and gives them a lien for the amount under their contract. At the time the judgment of foreclosure was taken, then, the mortgages were security for the amounts paid out in the purchases at the tax sales, and in payment of the subsequent taxes, as well as for the original indebtedness, and defendant' was clearly entitled to have all of said amounts included in his judgment against Hardin. He took judgment, however, but for the amount of the original debts, and he sold the whole of the mortgaged premises for the satisfaction of that amount.
It is very clear, we think, that the lien of the mortgage was thereby exhausted, and that the purchaser took a clear and absolute title to the premises. The case is not at all distinguishable in principle from Poweshiek County v. Dennison, 36 Iowa, 244. And the fact that plaintiff knew when he purchased the premises that defendant was claiming a lien thereon for the amount of the taxes, separate from the lien *711of the mortgage, in no manner changes the effect of the sale, for, as we have seen, the only lien which defendant had for said amounts was under the mortgage. The judgment of the district court is clearly right, and it is
Affirmed.