Doctors are teaming up with food banks to prescribe meals to their patients.

Six years ago, James Stancil, 62, a former long-haul trucker, decided to move from Iowa back to his hometown of San Francisco to live with his aging mother. There was just one problem: His enlarged heart, high blood pressure, and diabetes made his body so swollen he couldn’t get on an airplane. Doctors had to drain 75 pounds of fluid before he was well enough to fly. By the time he walked into a public health clinic near his mother’s house, his blood pressure was so high that “people were telling me, ‘You should be dead right about now,’” recalls Stancil, who’s African American and sports a white chinstrap beard. He was put on medications. He also met with a nutritionist, who urged him to cut down on salty, fatty foods like fried chicken and mac and cheese. After he learned to prepare his favorite dishes differently, his blood pressure plummeted; it’s now back to normal.

Stancil no longer has to take so many pills. Yet thanks to a new program, he still frequents a pharmacy at Silver Avenue Family Health Center—only this one fills prescriptions for things like pears and squash. The so-called food pharmacy brings together the resources of a food pantry with the acumen of clinical nutritionists and the flair of a farmers market, mostly to tackle high blood pressure and diabetes. Patients who receive a referral can stop by for donated groceries, recipe demonstrations, and cooking tips. Four more of San Francisco’s primary care clinics will host food pharmacies by next year.

Meanwhile, diet-related diseases continue to spread: 1 in 3 adults in the United States have high blood pressure, elevating their risk for heart disease and stroke. More than 7 percent of people have diabetes, mostly Type 2, up from 4.4 percent in 2000. In 2012, the disease cost the country $176 billion in direct medical expenses, plus another $69 billion in decreased productivity. Analysts at Thomson Reuters calculated that reducing employee health risks such as high glucose and blood pressure by just 1 percent could save employers $83 to $103 per person annually. The program is part of a movement to prevent and manage conditions through diet, not pills. “Often we just pile on prescriptions and ignore the other half of the equation for wellness, which is food,” says the San Francisco public health department’s Dr. Rita Nguyen, who spearheaded the city’s food pharmacy project. A 2015 study in the Journal of Biomedical Education found that only about a quarter of medical students get the recommended 25 hours of nutrition education. And as Nguyen points out, doctors have a financial incentive not to specialize in primary care: They’re paid well to cut out cancer or freeze warts, but not to “spend 15 minutes talking to someone about their diet.”

Even with a doctor’s nudge, eating healthily is easier said than done for poor Americans. Fresh produce is often much more expensive than packaged and fast foods. Most of Nguyen’s patients are on Medicaid, and 65 percent of them lack reliable access to affordable food, a situation experts call “food insecurity.” Food-insecure populations also see higher rates of high blood pressure, high cholesterol, and diabetes.