The state, through the agency of the state-operated facility, as defined in § 17a-458, authorizing the transfer of a resident to a private boarding home for mental patients, group home, chronic and convalescent hospital or other residential facility as provided by § 17a-509, shall pay the cost of the board and care of such mentally ill person, provided such cost shall not be in excess of the rates established under § 17b-340 for such facilities.