Comparatively to European universities (French, German, Italian, etc) British universities are very rich and well-funded, hence the bulk of the best universities in Europe being British. Admittedly British universities are nowhere near as wealthy as the top US ivy league universities. Anyway St Andrews meanwhile financially is a lot richer than many other British universities. They’re certainly nowhere near bankruptcy, they did controversially sell one hall because it was worth so much money to developers but I don’t think they’re selling any more.