THE main street of Hangbu, a town in Anhui, one of China’s poorer provinces, features the usual mix of rural businesses. Shops selling seeds and fertiliser; others stocked with tools and machinery; a few simple restaurants and a motel. And then there is a shop with a shiny display of iPhones and iPads.

The gadgets are a clue that rural China, long overshadowed by the country’s booming cities, is beginning to do better. More controversially, it also suggests that inequality, epitomised by a huge gap in wealth between cities and the countryside, may be declining. “I would not have opened up if people didn’t have money to buy,” says Yuan Yue, owner of the shop selling iPhones. “The money comes from sweat and toil, but incomes are rising.”

The gains from China’s remarkable growth of the past 35 years have not been evenly shared.

Studies, both official and independent, show that the country has changed from a very equal society into a deeply unequal one. The most commonly used measure of income inequality is the Gini coefficient, a number between 0 and 1 (0 means that all people have the same income, while 1 means that one person has everything). Officially, China’s Gini went from less than 0.3 in the 1980s, making it one of the world’s most equal countries, to nearly 0.5 today, making it one of the least.

Other sources indicate that the deterioration has been even more severe. In a widely cited survey, China’s Southwestern University of Finance and Economics concluded that the Gini had soared to 0.61 by 2010, in the same league as the world’s most unequal countries, such as South Africa. The discrepancy arises in large part because private surveys try to capture a broader range of income sources, including business and investment revenue, whereas official numbers focus on wages.

However, China’s Gini, though high, has started to decline. Officially it has been falling for seven years, from 0.49 in 2008 to 0.46 last year. The Southwestern University survey records only a tiny dip, from 0.61 in 2010 to 0.6 in 2014, but nevertheless corroborates the view that the worst might be past. “Even if official data understate the degree of inequality, the trend of lessening inequality is believable,” says Li Shi of Beijing Normal University.

From a national perspective, the biggest contributor to rising inequality had been the chasm between the countryside and cities. Now it appears to be the main reason for the decline in inequality. In 2009 the average urban income was 3.3 times higher than the average rural income. The gap has since narrowed to 2.7 times, following six consecutive years in which rural incomes have grown more quickly (see chart). Many of these rural folk in fact work in urban areas, staffing factories or toiling in basic service jobs, but China’s restrictive residency system prevents them from settling permanently in cities.

One explanation for the improving fortunes of such migrants is China’s demographic shift. The country’s working-age population has started to shrink. That has helped fuel wage growth for blue-collar workers. Another factor is that companies searching for cheap labour have moved farther inland, reaching parts of the country that are relatively deprived. Mr Yuan says he started selling iPhones in Hangbu after the arrival of a small cluster of electronics factories just outside the town.

Along the road to Hangbu’s industrial zone, a man sits at a stall trying to recruit workers.

Salaries of 3,000 yuan ($460) a month are just a bit lower than the norm for similar jobs in cities. “Trying to find employees is basically a year-round activity. It comes down to salary. If they aren’t happy, they leave,” says the recruiter.

This exemplifies a theory laid out in 1955 by Simon Kuznets, a Nobel-prize-winning economist.

He argued that as a country starts developing, a big gap opens between those lucky enough to work in better-paid jobs and those languishing in agriculture. But as growth continues, enough people are eventually absorbed into modern parts of the economy to reduce inequality again. Although the theory breaks down as countries get even richer, China seems to be following it for now.

Yet the shift has not occurred entirely spontaneously. It stems in part from redistributive policies.

Over the past decade China has expanded basic health insurance and welfare, made the first nine years of school free in rural areas and abolished a centuries-old agricultural tax.

Much more can still be done. Government spending on rural areas is still too low, especially through the state pension system. More fundamentally, Chinese law condemns country people to second-class status. In addition to the restrictions on moving to cities, they cannot sell their land, depriving them of what would otherwise be their most valuable asset. Without changes, inequality will continue to plague China. “If we purely rely on economic development, inequality won’t truly fall,” says Gan Li of the Southwestern University of Finance and Economics.

Moreover, the idea that income inequality may be declining is not obvious to many. Inequality of wealth (what people own, as opposed to what they earn) remains extreme. China has more dollar billionaires (596) than America (537), according to the 2015 Hurun rich list. A study by Peking University earlier this year found that the top 1% of Chinese households controlled a third of the country’s assets.

Ostentatious displays of wealth are less frequent since Xi Jinping took over the Communist Party in late 2012 and began a crackdown on corruption. But sports cars, ritzy restaurants and luxury clothing stores are still common in big cities. They are reminders of the riches of a small urban elite, even if the odd rural iPhone points to rising incomes in the countryside.