Germany offers both:
1. A free undergraduate university degree
2. For every graduate: 18 month work visa after graduation
3. For every STEM graduate who earns more than EUR 40,000 per year: approval to work in Germany forever (ie. a 'blue card')
Yes, you must first learn German, have good high school grades and be able to borrow EUR 9,000 to apply for the student visa. But for millions of people living in third-world countries that is achievable and a great investment given the enormous returns on offer.
So why isn't Germany flooded with foreign university students?