(1) Medicaid will be provided to the following AFDC-related institutionalized individuals under the heading categorically needy:
(a) Individuals under age 21 in intermediate care facilities, including in intermediate care facilities for the mentally retarded.
(b) Individuals under age 21 receiving active treatment as inpatients in psychiatric facilities or programs provided that the youth is in the custody of the department or has been committed to the department by district court pursuant to 41-3-403 , 41-3-404 , 41-3-406 or 41-5-523 , MCA.
(2) Medicaid will also be provided to the following AFDC-related institutionalized individuals under the heading medically needy:
(a) individuals described in (1) (a) and (1) (b) who are ineligible for coverage as categorically needy because of excess income.