The commissioner of corrections may enter into agreement with the commissioner of human services, with local probation officers or other public officials and with public or private agencies, schools or institutions, for custody, separate care, special treatment, training, or diagnostic services of persons committed to the care or subject to the control of the commissioner of corrections. The commissioner of corrections may pay any costs incurred by such agreements to the extent that funds for such purposes are made available to the commissioner by the legislature.