Section 29. The expense of keeping and maintaining convicts sentenced to imprisonment in the jail or house of correction, of the keeping of persons charged with or convicted of crime and committed for trial or sentence, and of prisoners committed on mesne process or execution, so long as the fees for their board are paid by the defendant or debtor, plaintiff or creditor, shall be paid by the county after the accounts of the keeper or master have been settled and allowed by the county commissioners, or, in Suffolk county, by the auditor of Boston; and no allowance therefor shall be made by the commonwealth.