Section 82. When the creditor has paid to the mortgagee, pledgee, lienor or conditional vendor, or his assigns, the amount ordered by the court, he may retain out of the proceeds of the property attached, when sold, the amount so paid with interest, and the balance shall be applied to the payment of his debt.