There is a joke that is told on campuses. “The voters like the idea that the state pays for student tuition,” goes the gag. “It is just that the state concerned is the People’s Republic of China, not Scotland.”

It is not the funniest line. Or the most accurate. But there is just enough truth in it to spark nervous smiles. That is because Scottish universities, especially some of the country’s most prestigious institutions, have become increasingly dependent on the fees paid by foreign students - nearly a third of them Chinese.

And this once booming business means universities are particularly exposed to the Covid crisis.

The government, despite the SNP’s flagship policy of free tuition, only picks up something like 90p in every pound it costs to teach Scottish, or, more technically, “Scottish-domiciled”, students.

To balance their books, institutions have sometimes lucrative sidelines, such as providing accommodation or campus coffees at a profit or using their facilities to host conferences. During the lockdown that income has evaporated, stripping £75m out of the sector.

Universities also have students from the rest of the UK who pay their own fees - but these do little more than cover costs. It is foreign students - who pay more than British ones - who are keeping the big prestigious institutions able to attract them in surplus. Until Covid, that is.

There are fears that half of those foreigners will not materialise this coming academic year. And not just because they do not want to come.

Even as lockdowns ease, prospective students are expected to struggle to get visas as bureaucracy catches up with a coronavirus backlog.

With flights cancelled all around the world, there are also simple logistical problems for students to get to Scotland.

In England and Wales some universities have said they will charter whole planes to bus in their customers. Scottish institutions are understood to have considered this but ruled it out as too complicated.

Universities, of course, do not just teach. They have a huge role in research too - and get funding from a variety of sources to carry this out. Does such funding really cover all the costs of research? Not necessarily.

So Scotland’s seats of higher learning are effectively operating an underlying structural deficit. Most of the prestigious ancient universities have been able to plug this gap with money from foreign students. Some of the more modern institutions, which tend to focus on local students and vocational courses, have not.

Despite the current crisis, none of this is news inside the sector. Late last year Scotland’s public finance watchdog Audit Scotland said that the aggregated financial position of the 19 universities was good but that surpluses were concentrated at three ancient universities, Glasgow, Edinburgh and St Andrews, with high numbers of foreign or English students.

Its snapshot, based on 2017-18, measured total income in the sector at £3.8bn. That number - thanks to fee-paying foreign students at Glasgow, Edinburgh and St Andrews - was up.

But success at the “rich three” concealed problems elsewhere. Only £1.3bn came from the Scottish Government to support students, including £1.1bn from the Scottish Funding Council. This SFC budget had fallen seven per cent in real terms since 2014-2015, the watchdog said.

The result: more than half of Scottish universities were in deficit in 2017-2018. Six of them were in deficit every year for four years. Modern universities are far more dependent in the SFC and struggling.

The Covid crisis has turned this reality on its head. Because it is now the ancients exposed to foreign students which are in the most trouble.

That is because foreign students at last count contributed account for £449m in fees, just under a third of this from mainland China. That is before universities sell them accommodation and other services. However, breakdowns of Chinese students alone show how different the picture is across the Scottish sector.

Edinburgh has 3,345 Chinese students. Across the capital Queen Margaret has just five. Glasgow has 3,230, Glasgow Caledonian has 90.

This Chinese market comes with a series of risks, including geo-political ones.

There are real concerns in Scotland that a dramatic worsening of relations between the UK and China, including the removal of telecoms giant Huawei from 5G infrastructure for national security and concerns about oppression of Uigher minority and the crackdown in Hong Kong, will affect the influx of students.

This summer Hong Kong students in Scotland - a significant group in themselves - said they felt the chilling presence of China on campus.

This was because of organised Chinese student groups and the presence of vetted mainland cadres working at controversial Confucius Institutes, language-learning centres funded by the Communist regime at five universities.

As recently as 2007-2008 there were just 3680 Chinese students at Scottish universities. The figure in 2018-19 was 11,400, paying £195m in fees. That is twice as much as the next biggest category, students rom the United States.

Last week Glasgow’s principal, Anton Muscatelli, warned that Britain’s ‘soft power’ would be eroded if universities were to be forced to turn away Chinese students. The rise in numbers from the authoritarian mainland is now down to universities choosing Chinese. It is partly because of UK Government immigration policies that make it easier for Chinese than, say, Indians or Nigerians, to get visas.

The big boom in international students is in people looking for post-graduate degrees.

In 2018-19 Scotland had 253,475 students, just over 189,000 undergraduates. Of these, 135,000 were Scottish, 23,000 from somewhere else in the UK, 14,300 from the EU and just under 16,000 from the rest of the world.

But on post-graduate courses Scots are in a minority. Just under 28,000 of the more than 64,000 post-grads in Scotland are Scottish. Nearly 9,000 are English, Welsh or Northern Irish, almost 7,000 from the EU and fully 20,620 are from the rest of the world.

The strange economics behind this boom has not gone uncriticised. Early in the lockdown Stirling academic Peter Matthews expressed “anger” at the Scottish Government for forcing universities to go to an international market to keep their heads above the water.

“Scottish universities have been forced to make a choice: stick to a flat-cash income from the Scottish Funding Council and watch your university slowly wither away as it loses staff through voluntary severance and natural wastage, and buildings and equipment fall into disrepair; or make riskier investment decisions in the hope than the return on these is high and allows you to expand,” Matthews blogged. “So we’re left with universities that have aggressively expanded into international higher education markets to pay for new staff, shiny new buildings and equipment, fantastic library resources and who are now horribly exposed as income from international students falls off a cliff.

“Students from Scotland will suffer because of this, as universities are forced to make staff redundant so class sizes increase and as very basic services like libraries and IT are curtailed to make budget savings.”

Covid is the short-term risk. But it has, critics exposed long-term vulnerabilities. There is no guarantee foreigners will keep coming.

Competition for international students is not easy. Universities, who say the have a collective backlog of £850m in capital repairs, have to look their best. Some have embarked on ambitious building projects.

They also have to look good in global rankings, which requires sound underlying financial health.

Scottish universities bob up and down global league tables. The latest QS world rankings have three Scottish institutions in the top 200, with Edinburgh in 20th spot and Glasgow and St Andrews lower down the field.

But institutions in English-speaking world - England, United States Canada and Australia - often outrank Scottish ones. And Chinese and other Asian institutions are rising fast with Beijing’s Peking University, or Beida, for example, now ahead of Edinburgh.

Scotland’s hybrid universities - with their austere managed state-funded market for local students and free-wheeling battle for global students - have more problems than Covid.