Currently English residents who attend a Scottish university pay for tuition, those from Scotland or elsewhere in the EU do not. This apparent discrimination was allowed by the European court because although you cannot discriminate against members of another EU state you can do so within your state. As England and Scotland are one member it's okay to have special rules that disfavour the English.
This has proved to be interesting now that Scotland are considering their independence. If they become a separate member of the EU then they cannot charge English (and Welsh) students. They are trying to wangle out of this on economic grounds but you could make that case for many laws. Businesses cannot ignore minimum wage requirements just because it affects their bottom line.
What I find more interesting is the fact that, according to EU law, I could legally discriminate against Scottish citizens. I could refuse to sell my house to a Scot and, because we are one member state, no EU law is broken. However it's not that simple. There are laws preventing discrimination covering many areas, employment especially, that forbid discrimination on grounds of sex, race, sexual orientation or religion. Remember the case of the guest house owners who didn't want to provide a double room to a homosexual couple?
So, in my opinion, the law is being broken. Either Scotland must treat English students the same as other EU ones or I can legally discriminate against the Scots, they can't have it both ways.