Court says states can decide medical necessity under Medicaid