The expenses of criminal prosecutions, except those before justices of the peace, shall be borne by the county in which such prosecutions shall be begun; and all net fines and forfeitures shall be paid into the treasury of such county. Defendants in cases of conviction may be taxed with the costs.