An ounce of prevention in community health programs could save states hundreds of millions in health-care costs, a new study has found.