At any sale under order of the district court, of lands upon which there is a mortgage or lien, the holder thereof may become the purchaser, and his receipt for the amount due him from the proceeds of the sale is a payment pro tanto. If the amount for which he purchased the property is insufficient to defray the expenses and discharge his mortgage or lien, he must pay to the judge an amount sufficient to pay such expenses.
R.L.1910, § 6403.