If a Government is strong enough, there is no need to keep the spellcasters out.
If it isn't, then it also can't throw them out, because they are too strong.
In either case, they can benefit from them- crafting magic items, taxes, solving problems, assisting in war- so they don't absolutely...