I would like to understand positive and negative effects for a host country and for a home country of a student.
To the host country:
Positive: A host country that is able to import top talent from other countries has a greater chance of keeping them in the country after graduation. This, undoubtedly, is an effort to promote national interests in a specific field (typically, scientific). Often, importing students to to do research is low cost (in comparison to hiring full time scientists or professors) and typically yields lots of deliverables (e.g. research papers) in a short time.
Negative: A host country takes a lot of risks when it invests in a foreign student. There no guarantee that student even graduates, much less that he/she remains in the country after graduation, or in any way promotes the host country's national interests.
To the home country:
Positive: A home country that can produce top talent gains a reputation international level for its education system (for better or worse, regardless of whether this is actually true or not).
Negative: A home country has the potential to lose its top talent to other countries, which is often counterproductive to its national interests (especially scientific interests).
In addition to the countries, i feel it is important to discuss the benefits and risks that this presents to the student as well:
To the student:
Positive: The student can gain a high quality education, typically with no strings attached. When they graduate, they are free to choose their destiny (assuming that they even have the option of staying in their host country).
Negative: The student effectively becomes low-wage, indentured migrant labor to the host institution. Students are often not promised jobs or citizenship in their host country, but are often led to believe that "it is possible if you work hard enough". This will often lead to foreign students out performing their domestic counterparts, but sadly offers little pay, benefits, or guarantees to the foreign student. As J.J. points out, if a foreign student screws up in some way, they lose (potentially) their only chance of a better life outside of their home country.
Home country positive: Sometimes the students come home to teach and do research after earning their degree bringing knowledge, expertise, and maybe prestige with them to help build programs back home. In some of these cases, the home country pays for them to go, earn their degree, and come back, and the student is under some form of legal incentive to come back (contract, release from compulsory military service, denial of departure if they ever come home for a visit, etc.). These kinds of things can occur in areas of research that are of national importance.