It's also presumably in the public interest that as many as possible are included in the pool eligible for qualified jobs (you want the top students to be doctors, not the children of rich parents).
Social mobility is also a factor, if university studies are expensive that will severely limit social mobility.
The conclusion is this: higher education should be free, and governments should not only ensure that it is, but that the free education holds at least the same quality as non-free (perhaps surprisingly this is already the case in many countries with free higher education).
Even without tuition fees, housing, food and books are expensive, so grants or cheap loans are still necessary.
The solution in Sweden and many similar countries is to have state guaranteed (I.e subsidized) loans where there is no private entity wanting a premium for the risk of lending money. The result is that anyone can afford taking loans to study, and it usually pays off very quickly.