WITH A MAXIMUM speed of 430kph (267mph), the Shanghai magnetic-levitation (or maglev) train is as much fairground ride as vital cog in the city's transport system. A stretch of the 30km track from Longyang Road to Pudong International Airport runs alongside a motorway. The speeding cars left behind are a guide to how fast the train is moving. For passengers who like to quantify their thrills, a digital speedometer in each carriage counts up the train's acceleration to its top speed before the numbers tumble again as the train slows towards the airport terminal.

The Shanghai maglev is a powerful symbol of China's modernity—even if the technology was developed in the 1960s in slowcoach Britain and the kit was made by Siemens, a German engineering firm. But the venture is not a money-spinner. On a midsummer afternoon, the train is half-empty and many of its occupants are tourists travelling just for fun. That is because, for all its impressive speed, the maglev is not a great way to get to or from the airport. Tickets are too pricey for all but rich business folk and foreign tourists, and those customers find the line inconvenient. Once they alight at Longyang Road they are still some way from the financial district and the best hotels.

Sceptics about China's economic miracle see the Shanghai shuttle as an example of how badly state-directed banks allocate capital. China invests some 50% of its GDP, more than double the average in rich countries. The big capital projects of state-owned enterprises, such as railways, receive funding on easy terms, but interest rates paid on bank deposits are capped. A system that favours certain borrowers over ordinary savers or bank shareholders is bound to back ill-judged projects and run up bad debts, argue the bears. A collision between two high-speed trains in China on July 23rd, which killed 40 and left 191 injured, seemed only to confirm those suspicions.

Let's leapfrog

But there is a kinder interpretation of China's appetite for prestige projects such as high-speed rail. Its leaders must know that as an economy develops it cannot rely indefinitely on copying the machinery and know-how of richer countries. The better-off a country becomes, the closer its technology is to best practice and the fewer of its workers are left in low-productivity jobs such as farming. The easy catch-up gains are exhausted and the economy slows or gets stuck. One way out of this “middle-income trap” is by trying to leapfrog the technology leaders.

China's recent growth has been so impressive that it seems churlish to question whether it can continue. Yet the country will find it more difficult to grow quickly as it becomes richer, as will India and Brazil. All three big emerging markets need to find ways to avoid the inflation that has bedevilled developing countries in the past, and to strike a good balance between consumption and investment, foreign and domestic demand.

China's reliance on exports and on investment that supports export industries has reached its limits. The country now needs to shift the balance towards domestic demand, which requires capital to be redirected toward the smaller enterprises that serve consumers. Brazil is almost the mirror image of China. It has a thriving consumer economy which it is finding hard to keep in check. Its high interest rates discourage the investment spending it needs to improve its poor productivity record. And it needs to make sure that the strong currency that comes with a booming commodity sector does not leave it with too narrow an industrial base. India, like Brazil, is prone to overheating and has a current-account deficit, though thanks to its high investment rate its productivity record is closer to China's.

The problems of middle-aged development will soon afflict China and others, according to research by Barry Eichengreen of the University of California, Berkeley, Donghyun Park of the Asian Development Bank and Kwanho Shin of Korea University. They examined middle-income countries (with earnings per person of at least $10,000 in 2005 prices) which in the past half-century had enjoyed average GDP growth of at least 3.5% for several years but whose growth rate had subsequently fallen by at least two percentage points. The research confirmed their hunch that the loss of momentum is mostly due to economic maturity rather than a shortage of workers or a slackening in investment. The workforce grew at the same rate after the slowdown as before it, and its quality kept improving: indeed the average worker acquired skills at a slightly faster rate after the economy had slowed. The increase in physical capital (factories, offices, roads, machines and so on) tailed off, but this accounted for only a small fraction of the drop in GDP growth.

Instead, most of that drop was caused by a slump in “total factor productivity”—the efficiency with which workers and capital are used. “Growth slowdowns, in a nutshell, are productivity-growth slowdowns,” write Mr Eichengreen and his colleagues. A decline in total factor productivity is what you would expect when the “easy” phase of economic development comes to a close. Moving underemployed villagers into urban jobs in factories and offices with imported equipment raises productivity. But as rural slack is used up there are no more such gains to be had.

According to the three economists, this sort of slowdown is most likely to happen when average income reaches around $16,000 in 2005 prices; when income per person rises to 58% of that in the world's leading economy; or when the share of employment in manufacturing gets to 23%. Those three thresholds—of which the absolute level of income is the most important—will not necessarily all be reached at the same time. China may already have hit the manufacturing target, and if its economy sustains a growth rate of around 9%, the average income threshold will soon be breached. But the relative income threshold remains far off. In 2010 China's income per person was 16% of America's, according to the IMF.

The research shows that economies such as China's, with an undervalued currency and a low rate of consumer spending, are more likely to suffer such a growth slowdown. These milestones are based on averages of many countries that lived through sudden slowdowns, and their experiences varied widely, cautions Mr Eichengreen. These are not iron laws. Even so, it seems certain that a slowdown will follow once the easier part of the catching up has been done. The question is whether China can mitigate this by changing its growth model.

Last year's model

That model has proved successful in other parts of Asia. It is export-led, so demand has been mainly from abroad. To meet it, China has mobilised its vast reserves of cheap labour, to which it has added a fast-growing stock of physical capital, much of it imported but financed from the country's own savings. Because of China's capital-intensive growth model, consumer spending has an unusually small share of GDP: in 2010 it fell to only 34% (see chart 1). This only adds to the reliance on exports.

China's financial set-up reinforces this model. The flow of capital across its borders is heavily policed. China has curbed the rise in its currency, and kept its exports competitive, by buying huge quantities of dollars and other foreign currencies, amassing $3.2 trillion of foreign-exchange reserves, worth 54% of China's 2010 GDP.

The banking system is closely managed by the state. Foreign banks account for barely 2% of total bank assets. The cash created to keep the yuan down is mopped up by forcing China's banks to buy low-yielding “sterilisation” bonds or to hold more cash in reserve. Interest rates are set in favour of state-owned companies (often monopoly suppliers to exporters) but offer little reward for householders. Credit for consumers is still scarce.

China's growing weight in the world economy means it cannot rely indefinitely on other countries' spending

China's growing weight in the world economy means it cannot rely indefinitely on other countries' spending. The debt overhang in parts of the rich world means that China's foreign customers are hard-pressed. And the country is a drain on demand from the rest of the world: its current-account surplus (a measure of its excess saving) rose above 10% of GDP in 2007, though it has since halved. This is a source of tension: the Americans complain that China's exchange-rate policy provides its exporters with an unfair subsidy at the expense of their own workers. The export-led strategy is also beginning to lose its potency. Each rural migrant set to work on machinery to serve China's foreign customers is harder to find than the last.

If China is to avoid the middle-income trap, it needs to develop its domestic market. It must switch from indiscriminately amassing factories, ports and other fixed assets to a more finely graded allocation of capital and workers that allows small service firms to flourish. That transition will be helped along by two factors. As the working population starts to shrink around 2015, the household saving rate should fall because countries with fewer earners and a larger proportion of dependents tend to spend more. And China already devotes a bigger share of its GDP to research and development than do other countries with similar income levels. That gives it a better chance of sustaining productivity growth when the gains from adopting existing technologies run out. But other facets of China's economy militate against change. For example, the World Bank ranks China 65th out of 183 countries for giving companies access to credit, behind India (in 32nd place).

The obstacles are formidable. Shifting to an economy that concentrates on consumers will mean dislocating entire industries. Higher wages in China, which are needed for this sort of rebalancing, are already driving some textile jobs to Vietnam and Cambodia. Removing implicit subsidies to rents and interest rates would cut many firms' profits and stir opposition. Banks used to dishing out capital at the government's say-so would need to make finer judgments, withholding money from industries with low returns and moving it to promising new ventures. But will they be able to tell the difference between the two?

Brazil is the textbook example of a fast-growing country that hit a wall (though it is not covered in the study by Mr Eichengreen and his colleagues). Its economy grew by an average of almost 7% a year between 1945 and 1980. GDP per person rose from just 12% of America's to 28%, according to the Maddison statistics. But then convergence went into reverse. The debts accumulated to pay for imported machinery became crippling as interest rates shot up. Industries that had served a protected home market were revealed as inefficient. A weak currency and wage indexation fed first inflation and then hyperinflation.

A series of monetary and fiscal reforms in the 1990s tamed inflation and arrested the decline in relative income. Brazil's income per person is now above 20% of America's level. But the economy suffers from frailties that are the mirror-image of China's. Investment is 19% of GDP, well below China's and quite low even by rich-world standards. That is one reason why productivity is feeble, though Brazil's woeful education system and decrepit infrastructure are also to blame. The economy tends to grow at around 4% a year, faster than most rich countries but more slowly than Brazil's emerging-market peers.

Weak investment reflects low domestic saving. Brazil still habitually runs a current-account deficit. This reliance on foreign capital has left it vulnerable to periodic balance-of-payments crises, though it has piled up $344 billion of foreign-currency reserves to fend them off in future. Brazil's net foreign liabilities (private and public) amount to $700 billion, compared with China's net assets of £1.8 trillion.

The flip side of Brazil's low saving is strong consumer spending, at 61% of GDP last year. The business of providing loans to householders is booming. This is in part because BNDES, the state-owned development bank, provides subsidised loans to Brazil's big state-directed companies and to some other firms. That limits opportunities for business lending, so private banks must look elsewhere.

There is ample scope to lower the “Brazil cost”—local shorthand for a range of handicaps

Brazil's economy has two great strengths. Its population of working age is growing quickly, and it is rich in natural resources at a time when emerging markets are industrialising at an unprecedented rate. Brazil vies with Australia as the world's largest exporter of iron ore, much of it to China. Its plentiful arable land is astonishingly fecund (in some places three harvests a year are possible), thanks to an ample supply of sun and fresh water. The “sub-salt” reservoirs off Brazil's south-eastern shore contain at least 13 billion barrels of oil.

The commodities boom and the oil finds have freed Brazil from its traditional balance-of-payments constraints. Foreign money is flooding in, lured by Brazil's high interest rates and the expected earnings once the oil starts to flow. But that creates a new problem: a strong currency that hurts the country's exporters outside the resource industries.

The textbook remedy for this sort of “Dutch disease” is to raise productivity or lower costs in tradable industries that do not benefit from the resource boom. In August the government said it would abolish payroll taxes in four labour-intensive industries: footwear, clothing, furniture and software. There is ample scope to further lower the “Brazil cost”—local shorthand for a range of handicaps including ramshackle roads, high interest rates, jobs levies, taxes and bureaucracy.

Brazil is one of the most onerous countries to do business in, coming 127th out of 183 in the World Bank's ranking. Hiring and firing is costly and closing a business can take years. The tax system is complex and bedevilled by rules that often conflict. “If you're honest and want to comply with the tax code, you need an accountant and a tax lawyer for life,” laments one São Paulo-based economist.

Real interest rates in Brazil are among the highest in the world. The central bank's benchmark rate is 12% and may need to rise again to tame inflation, which is well above the target of 4.5%. High rates are in part a legacy of past inflation that punished saving and rewarded borrowing. A culture of saving has yet to take firm root, so demand for credit outstrips supply. Fiscal laxity has also played a part. The economy is running at or beyond full capacity. The jobless rate is 6%; it has rarely been lower. Brazil's budget ought to be in surplus. Government debt is rolled over every three years and crowds out other borrowing. But a market for longer-term debt would require a commitment to keeping public-sector payrolls and state pensions in check.

Brazil hopes that the oil discoveries will be exploited in a way that helps other industries rather than harming them. The government has insisted that Petrobras, the state-controlled oil giant with sole operating rights in the sub-salt field, must buy most of its supplies in Brazil.

Eike Batista, a colourful magnate with interests in mining, oil exploration and logistics, is building a port complete with shipyard (in tandem with Hyundai, a South Korean firm) to comply with the local-content rules. “The demand from Petrobras could fill two shipyards,” he says. A modern port will encourage foreign manufacturers to build factories along Brazil's coast and serve the domestic market. “Brazil will not be trapped in commodities,” he insists. But others worry that Brazil is flirting with a state-influenced and inward-facing model of industrialisation that has failed before.

Brazil and China need to make different sorts of transitions if they are to sustain their development. Brazil has to save and invest more; China needs to consume more. Brazil is rich in resources; China is hungry for them. Brazil is short of good roads and railways; some of China's will attract too little traffic. Brazil is young; China is ageing. “Perhaps they should merge,” is the wry suggestion of Arminio Fraga, a former central-bank governor of Brazil who now runs Gávea Investments in Rio de Janeiro.

India's bumpy road

India's main challenges are a mix of those facing Brazil and China. Like China, India has enjoyed a recent growth rate above the emerging-market norm, at around 8% a year. It ought to be doing better still: after all, it is poorer than China, so the scope for catching up is greater. Investment is a healthy 38% of GDP. Much of India's investment is financed out of companies' own pockets, a symptom of an immature financial system. Most firms cannot rely on external funding, though giant Indian conglomerates, such as Tata, are able to tap into international capital markets.

Like Brazil, India is in desperate need of better roads to link its far-flung internal markets. It is a young country, with its working-age population set to grow at 1.7% a year until 2015, a faster rate even than Brazil's. But too many of its people are educated badly, if at all. As in Brazil, companies often have to provide remedial education to bring recruits up to scratch. Arcane laws stand in the way of a well-functioning jobs market. Corruption is a blight on infrastructure projects. The economy is prone to overheating and has a current-account deficit.

This speaks of a deeper weakness in emerging markets. In the past they have not been good at managing internal demand. Relying on exports allowed them to grow and save at the same time. Now that the rich world's economies are struggling, that has become harder, raising the prospect of the sort of ills that led to emerging-market crises in the past: excess government spending, rapid credit growth and inflation. The transition from middle-income to rich economy relies on sound monetary, fiscal and regulatory policies, says Raghuram Rajan, a former IMF chief economist now at Chicago's Booth School of Business.

The fear of renewed trouble in the debt-laden rich-world economies has meant that Brazil and India have been slow to stop local inflationary pressures from building. China passed its first big test filling in for rich-world demand when it increased bank credit by an astonishing one-third during 2009. It was a welcome stimulus to the local and global economy, but there are growing doubts about the wisdom of many of those loans. The debts run up by local authorities to finance infrastructure are of particular concern.

China bulls argue that the expenditure was essential to the country's rebalancing. Better transport links between the rich coastal cities and poorer western regions were needed to develop China's internal market. Sceptics see roads with no cars, trains with few passengers and empty buildings. Some reports say 2 trillion yuan of local-authority loans have gone sour. Worryingly, some of the foreign investors who had rushed to take stakes in Chinese banks are slinking away. Bank of America, which has problems in its home market, has sold half its stake in China Construction Bank.

Even so, stabilising aggregate demand may prove easier than settling the social conflicts or tackling the industrial stasis that entrap middle-income countries. This depends not only on a well-tuned economic engine; it also relies on how fairly the pain of adjustment is shared, says Harvard University's Dani Rodrik. Societies torn by class or other rivalries are often set back by economic change. Democracies with rules and procedures for settling disputes and compensating losers tend to do better.

Mr Rodrik contrasts South Korea's bounce-back from the East Asian crisis in 1998 (as well as from earlier troubles) with the slump endured by Brazil and other Latin American countries in the 1980s. South Korean industry had been tested in export markets so it could build a recovery on its industrial strength. Brazil had lacked that strength. But South Korea was also able to recover more quickly because each interest group agreed to absorb some of the pain from the downturn. The government said it would do its best to help the country get over the crisis but firms should do their bit by avoiding lay-offs and unions should moderate their wage demands. In Brazil, by contrast, everyone tried to shift the pain of lower living standards onto others. Inflation took off and Brazil's GDP per person stagnated for 15 years.

China may have the stronger economy, says Mr Rodrik, but Brazil and India are likely to be better at handling the social mobility that comes with being a middle-income country. All three of these emerging-market giants will have to work hard to avoid the middle-income trap. Their recent economic performance is good but experience suggests that there will be setbacks. Yet as the rich world stumbles from crisis to crisis, the prosperity gap is closing fast. America's claim to economic leadership looks increasingly threadbare, and one of its long-held privileges—having the world's main reserve currency—is under threat.