The pound keeper shall not deliver the beasts to the owner, until such owner shall pay him his fees, and the expense of keeping such beasts, together with the sum so demanded by the distrainer, and the expense of advertising such beasts, if they shall have been advertised, and all other legal costs and expenses.