Whenever a person who is committed to an institution subject to the jurisdiction of the State Department of State Hospitals or the State Department of Developmental Services, under one of the commitment laws that provides for reimbursement for care and treatment to the state by the county of commitment of the person, is accused of committing a crime while confined in the institution and is committed by the court in which the crime is charged to another institution under the jurisdiction of the State Department of State Hospitals or the Department of Corrections and Rehabilitation, the state rather than the county of commitment shall bear the subsequent cost of supporting and caring for the person.