The contract may provide, with respect to any situation in which, under the law, a sheriff is authorized to transport a prisoner from the sheriff’s own county to a point in another county, or is authorized to take a prisoner into custody in another county and transport him to the sheriff’s own county, that a sheriff of either of the contracting counties shall perform such function.