Let’s give everyone free healthcare!
Everyone at first: Yay, this is awesome. I pay a little more taxes but it’s offset by not paying that insurance premium.
Doctors: Well you are controlling costs by severely limiting my pay versus my student loans… doesn’t seem financially sensical for new people to become doctors.
Ok… then let’s pay for everyone’s education!
Everyone: Sweet, I am ok with the higher taxes cause it replaced my student loan bill.
Overtime the costs increase so taxes increase…
Everyone: Ok these higher taxes aren’t making this so awesome anymore get these costs under control.
Well one way we can control costs is by only letting people come to the country if they are less likely to need government services. Taxes still increase so the poorest and most ambitious move out to seek opportunity elsewhere, only other well to do people can move in so costs balances out with revenue but you’ve driven out the poor and most ambitious who these programs were for in the first place.
All the statistics look good cause your population appears wealthier, smarter and healthier cause everyone else moved out.
If every country did this the poor would be stuck in their country of origin as no nation would accept the poor and huddled masses to control costs. The rich and well to do would still be free to travel around the world but the poor become geographically frozen from seeking greener pastures allowing generational poverty to develop whose plight is diminished by government services but do to a lack of free movement becomes perpetual.
This may take several generations to play out, but it will play out.
(This doesn’t even consider the effects on innovation and the likely labor protections that would form that would create persistent youth unemployment, but let’s keep it simple)