The sheriff, for performing the duties required of him by this article, shall be allowed five per cent on the first $100 and two per cent on the residue, which commission shall be deducted from the purchase money and the balance credited on the debt due the state. The costs of publishing notice in a newspaper shall be paid out of the proceeds of such sale.