It’s one of the best-established relationships in economics: as women’s education and income levels go up, the number of children they have goes down.

But something happened to the American family over the last three decades: that downward slope became a U-turn. Women in families in the top half of the income spectrum are having more kids than their similar-earning counterparts did 20 years ago. Women from the very richest households are now having more children than those less-well off. Less than 28% of 40- to 45-year-old women in a household in any income bracket below $500,000 per year have three or more children, according to data from the 2011-2015 US Census, while 31.3% of families earning more than $500,000 do.

Money has always given wealthy people the option to pay for things that make it easier to have large families: childcare, a bigger house, help with chores at home. The ability to welcome as many children as ones likes into a family and afford them generous opportunities (while still pursuing one’s own career and interests) has to be one of wealth’s greatest perks. But a deeper look at the data shows that increasing abundance for families at the top is built on declining opportunities for those at the bottom.

More income and education used to lower fertility precisely because it raised the opportunity costs of having a child. Women lost a lot economically if they cut back on work to attend to an expanding family, so they had fewer kids and invested more in those they had.

But as wealthy people’s income rose faster—much faster—than poor people’s, it became that much easier for the wealthier to hire low-wage workers to help them care for their children, according to an analysis of the US trend at the UK’s Centre for Economic Policy Research. US families in the top 25% of the income distribution have spent drastically more on childcare since 1990, while those in the bottom quarter were generally priced out of the childcare market, opting instead to leave children with relatives and neighbors.

It’s part of a larger trend of wealthy families investing increasing amounts of time and money in their children’s education and development. It’s also given women at the upper end of the socioeconomic spectrum more choices. In 1990, a woman with an advanced degree was more than twice as likely to not have children as a less-educated woman, the authors found. Today well-educated women are just as likely to be mothers as anyone else.

“When inequality grows, people who have higher incomes can afford to hire people with lower incomes more easily,” said David Weiss, an economics lecturer at Tel Aviv University and a co-author of the paper. “As soon as you can do that, rich women can hire help to take care of their children and simultaneously have a career.”

Inequality has given women the freedom to “have it all”—but only for those who already have a lot.