Funding bodies in the UK and EU, and elsewhere, have a fairly wide latitude on who they can restrict funding to. There are some protected characteristics (e.g., age) that cannot be used in the determination, but I am not aware of any country that classifies nationality as a protected characteristic.
The Leverhulme guidelines say:
While the scholarships may be held by students of all nationalities, the Trust has a particular interest in supporting UK or EU students.
The RCUK guidelines say:
Normally to be eligible for a full award a student must have no restrictions on how long they can stay in the UK and have been ordinarily resident in the UK for at least 3 years prior to the start of the studentship (with some further constraint regarding residence for education).
This is in essence UK/EU citizens and individuals with ILR. So in summary, I believe UK funders can limit the funding to UK/EU nationals.
It is also worth noting that there are also substantially different fees for UK/EU nationals and citizens of other countries, so from a practical standpoint the studentship may not be able to support an international student.
Studentships is only part of the admissions process. There is no reason you cannot apply to these programs as a self funded student.