IT IS a bad time to be a middle-aged, middle-class, white American. Stripped of manufacturing jobs by trade and technology, then skewered by the financial crisis, white men aged 45 to 54 earn 7% less, in inflation-adjusted terms, than in 1987. Their suffering is not just financial. In November Anne Case and Angus Deaton, two economists, found that middle-aged whites were more likely to die in 2013 than they were in 1999. Another study recently found that, since 2001, gains in life expectancy at 40 have been unevenly distributed, benefiting the rich most. Yet the plight of middle-aged, middle-income whites, while distressing, is atypical. Across the whole population, the chance of early death depends ever less on economic circumstances.

In a recent article in Science, Janet Currie of Princeton University and Hannes Schwandt of the University of Zurich rank America’s counties by the proportion of their residents living in poverty. The poorest areas are clustered in the South; the poverty rate in Holmes County, Mississippi, for example, is over 40%. Counties with the least poverty are likely to be near rich, northern cities; Somerset County, New Jersey, an hour’s drive from Manhattan, has a poverty rate of only 5%. In general, the poorer the county, the more deaths. The researchers examined the strength of this relationship in three-year periods starting in 1990, 2000 and 2010.

Mortality has fallen for almost everyone. You would expect this: health care and lifestyles (most notably, smoking rates) have improved. Less predictably, age affects how those gains are divvied out between rich and poor (see chart). Those over 50 have done best in rich counties, reinforcing the notion that the link between income and health is strengthening for the middle-aged. Yet among the young—and particularly among young men—the biggest gains have been in the poorest places.

There are three likely explanations. First, crime has fallen, benefiting poor areas more. In 1990 there were 37 homicides per 100,000 men aged 18-24. By 2014 there were 20. This has particularly affected black men, who more frequently fall victim to murder. In 1990 twice as many young black men died from any cause as young white men. That has fallen to 50% more, with the lower murder rate accounting for four-fifths of the improvement.

Second, HIV is killing fewer people. This is partly due to fewer cases. In 1990 there were 21 incidences of HIV/AIDS per 100,000 men; today there are 12 (though all the progress was before 2000). It is also due to better treatment. Because the HIV epidemic is concentrated in poor, black, southern areas, falling deaths from HIV make mortality rates more equal. HIV mortality has fallen most among 25- to 44-year-olds; among black men in this age-group, HIV deaths are down by 90% since 1990.

The third explanation is better health care for mothers, babies and children. During the 1980s, for instance, Medicaid coverage for pregnant women was greatly expanded. The benefits were long-lasting: a study in 2015 found those whose mothers were included in the expansion were healthier in adulthood. Among other things, they were less likely to be obese.

In 1997 the federal government also began helping states provide health insurance to children in families that were poor, but not poor enough to qualify for Medicaid. This has probably reduced infant deaths that happen after mothers and babies leave hospital. A study in 2014 found that such deaths are largely responsible for America’s persistently high infant-mortality rate compared with Europe’s.

Targeted interventions such as the 1997 reform probably reduced infant mortality among the poor. The expansion of the earned-income tax credit in the 1990s may have helped, too, by reducing the strain on mothers, or improving toddlers’ nutrition. Other public-health improvements, such as cleaner air—particularly important for childhood health—have also disproportionately benefited poor areas.

These trends are especially welcome because more equal mortality should persist throughout the lives of today’s youngsters, argues Ms Currie. Frustratingly, this does not show up in the most-used statistic: life expectancy at birth, which rose by about the same amount in rich and in poor counties. Life expectancy is calculated by assuming that people continue to die at the same rate as today, so that opposing mortality trends among young and old cancel each other out. But in reality, mortality rates evolve over time. Today’s poor and middle-income young may avoid the malaise currently afflicting middle-aged, middle-income whites. Manufacturing jobs lost to trade cannot easily be lost a second time. The opioid epidemic ravaging communities today may yet be vanquished.

If so, the gap in life expectancy at birth between rich and poor will also fall. This has already happened between whites and blacks, because middle-aged blacks are living longer (for that, thank falling rates of cancer and heart disease). As a result, the life expectancy of whites is now just three-and-a-half years higher than that of blacks, down from seven years in 1990.

In short, income and race have an ever-weaker effect on mortality, despite rising income inequality. Thanks to the plight of middle-aged whites, this good news is easily missed, says Ms Currie. Evidence, perhaps, of a different sort of inequality.