Dr. Jesanna Cooper cried when she heard that the labor and delivery unit at Princeton Baptist Medical Center in Birmingham, Ala., would close in October 2023. She’d started delivering babies at the hospital in 2013, and had helped make it one of the top units in the U.S., a huge accomplishment in a state with one of the highest rates of maternal mortality.

Princeton Baptist is located in a low-income part of Birmingham where birthing mothers often had serious complications. But Cooper and her partners in private practice worked with the hospital to bring in midwives, reduce the number of C-sections, and lower the amount of obstetric trauma women experienced. “We realized that we could really change an entire community’s health trajectory,” she says.

Yet Cooper left the practice in December 2022 after getting burned out. The next fall, Brookwood Baptist Health, which owns the hospital, said it was discontinuing ob-gyn programs at Princeton and another Alabama hospital to “allow these hospitals to focus more strongly on the services their patients trust them to provide.” These were two of the hundreds of maternity wards to close across the U.S. in recent years— since 2011, according to the health care consulting firm Chartis, leaving many women in regions without care. Tenet Healthcare, which owns Brookwood, did not return multiple requests for comment from TIME. But doctors and analysts say there’s little mystery why providers shutter labor and delivery units: they make comparatively little money, and, in some cases, they lose a lot of it.

“Average reimbursement for obstetric care turns out to be quite low, if compared to other types of services,” says Caitlin Carroll, a professor at the University of Minnesota who studies health economics and hospital closures. “So hospitals are closing their labor and delivery units because they tend to be unprofitable.”

Few hospitals have said as much publicly. But hospital administrators have indicated in discussions with academics that labor and delivery units are often in the red. For a long time, the field has been known as a “loss leader,” meaning it loses money but might bring in new business as families who delivered at a hospital return there for care. Private practices are struggling too, with ob-gyn providers experiencing burnout. Cooper was the only ob-gyn at her private practice for six of the 10 years she was there, which meant she was on call 24/7. She tried to recruit a partner to join her but the pay was too low and hours too grueling, she says.

There are a number of reasons why the U.S. health care system is falling short when it comes to maternity care. All of them are about money. Insurance reimbursement rates are set in large part by a committee that critics say undervalues ob-gyn care relative to other, high-profit specialties.A large proportion of births in the U.S. are reimbursed through Medicaid, which pays hospitals less than other insurers. Because of the way billing codes are structured, pay for maternity care is often made in a lump sum meant to cover a woman’s whole pregnancy, which doctors say significantly under-prices the care they give. And some private insurers have gained near-monopolies in some states, shrinking competition and doctors’ ability to negotiate. Obstetrics also has among the highest rates of malpractice suits, which drives up insurance costs and pushes doctors away from the field. Taken together, the increasingly profit-driven business of health care has little incentive to focus on what is the most important moment in many people’s lives.

The irony of closing maternity wards isn’t lost on Cooper, who met me in a barbeque restaurant in Birmingham where she spotted a young child who had been delivered on her watch. The act of bringing a baby into the world is one of the most important things we do as a society—a matter of the survival of our species—but our health care system, as she laments, does not compensate for the work in line with its value. “How is it that we got paid $1,000 for nine months of prenatal care, labor and delivery, and postpartum care, but one hour of a joint replacement gets paid $1,600?” Cooper asks, referring to Alabama’s Medicaid reimbursement rates.

The low compensation rates for labor and delivery have big implications for U.S. maternal and fetal outcomes. As maternity wards close, women have to travel further for care, making it more difficult to both make their normal appointments and to get to the hospital in time once they go into labor. About half of women who live in rural areas must travel more than 30 minutes to an obstetric hospital, according to the March of Dimes. This leads to a 9% increase in the probability of maternal deaths or a severe health episode compared to women in areas with greater access, the March of Dimes finds. Black women already have higher rates of death and complications in birth than do white women, yet 1 in 6 Black babies in 2022 were born in areas of limited or no access to maternity care.

There are two big costs when a woman delivers a baby. The first is what her doctor gets paid for care. Then there’s the fee paid to the hospital for facilities, equipment, and staffing. Hospital fees can be quite high, because maternity wards have to be staffed every hour of the day, every day of the year, with access to operating rooms and anesthesiologists. A doctor’s fees for maternity care—what Cooper got paid—are often compensated through what’s called a “global fee,” which is essentially a lump sum to cover prenatal appointments, labor and delivery, and the first 60 days postpartum.

Policymakers switched to bundled payments like this in the 2010s in an effort to reduce costly and unnecessary services. But rates have not kept pace with inflation and do not cover important services like maternal mental-health screening, says Joy Burkhard, policy director of the Policy Center for Maternal Mental Health, a nonprofit think tank. The global fee is derived from examples of an uncomplicated pregnancy, delivery, and postpartum care.

“The global fee needs to change,” says Lisa Satterfield, the senior director of health economics at the American College of Obstetrics and Gynecologists (ACOG), calling for payers to unbundle different services provided at birth to increase doctor compensation. “It was meant to do good and has not.”

That the use of one billing code can wreak so much havoc on ob-gyn practices highlights a huge problem with the U.S. medical system: doctors are not paid for outcomes, but rather for performing a service. Because of the way we value those services, doctors who do some of the work that you’d think society considers most vital are in some cases losing money, and in others just breaking even.

In 1992, after a Congressional commission reviewed increasing physician pay and recommended a change in how compensation was calculated, Medicare transitioned to a system that pays physicians based on what’s called “relative value units” (RVUs). RVUs calculate how much skill and time is required for different procedures. Every few years, the American Medical Association’s (AMA) Specialty Society Relative Value Scale Update Committee, a group of doctors and health care professionals known colloquially as the RUC, updates RVUs. The Centers for Medicare and Medicaid Services then uses these RVUs as one of their inputs in setting rates. Private insurers also use the RUC to help determine their compensation rates.

Some doctors believe the RUC undervalues services for women because of the legacy of sexism in medicine. “When you compare anatomically similar RVUs between a variety of different surgeries, you’ll see that gynecologic surgery typically falls short in terms of reimbursement,” says Louise King, an ob-gyn and professor at Harvard Medical School, and the co-author of research that argues that care by women doctors and care for women are compensated at lower rates.