Whoever is convicted of a crime, punishable by imprisonment in the jail or house of correction, may be sentenced to a jail or house of correction of any county, and the master or keeper shall receive and detain him in the same manner as if he had been sentenced by a court sitting in the county where such jail or house of correction is situated.
Mass. Gen. Laws ch. 279, § 15