This program has diverted scores of mentally ill people from jail into treatment. It’s also saved millions