What are interests of a country to fund international PhD students?

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.