The factors which allow countries to produce lots of brains may be the very factors that mean such brains will find better opportunities in countries that are better able to pay brains.
Whether the countries producing the brains are able to benefit from their education-positive actions depends on whether the brains who leave for better opportunities consider their success to be a function of their childhood country or their own hard work.
Countries that produce brains need to work hard in order to ensure that people recognise the source of their success.
Brain drainees are countries that lose qualified people to other countries. Brain drainees typically need to create the brains in the first place and typically there are some conditions that need to be met in order to do this. In order to develop an educated population you need pupils who have enough to eat and drink, feel secure and who are not compelled to work as child labourers. Ideally, they should not have so much wealth that they have too much access to distractions that will keep them away from their studies.
You need parents who are willing to provide the time and attention needed for children to learn i.e. people who don't feel compelled to work excessive hours in their employment activities either because such work is badly paid or because it is so well paid but competitive that they have to work those hours to keep up with their peers. You need a social system that keeps parents with children rather than in bars.
You need teachers who are qualified, i.e. those who know their subjects well enough that they want to impart knowledge rather than rote learning. And you need education leaders who see their leadership positions as ones that serve society rather than their own pockets.
Countries can create brains for export without the above conditions, but the above represent an ideal, a sort of goldilocks zone. Societies that are neither too dysfunctional or too successful.
Being in the goldilocks zone also means that parents, teachers and children see the value of utilitarian, functional subjects such as maths and engineering. In contrast in more developed societies there may be a tendency to study more values-expressive subjects such as the arts and social sciences.
These are societies that systematically draw brains from other countries. Typically these societies are rich. People with brains do not move to poor countries unless they are on a World Bank or an NGO contract.
The wealth of these societies means that the children within them have access to distractions, X-boxes do not play themselves, this means that they don't create as many brains as they could. There are other factors at play as well. Parents may find it more economically beneficial to spend time at work rather than with kids and they may also find it more productive to have less kids to begin with. Both factors reduce brains.
In such societies, there are good teachers, (obviously). But supply may be limited, this is because people who are well-qualified have a lot of other employment opportunities that are typically better paid than education. Teachers could be paid more, but typically these societies find it more effective to reduce tax rates in order to encourage commerce and enterprise and/or spend their budgets on the military which in turn create non-education job opportunities.
The lack of parental support at home, the availability of distractions and other social forces that challenge traditional teacher/pupil relationships can also mean that teaching becomes more demanding and challenging.
Because these societies are rich, however, it remains relatively easy to recruit qualified people in a range of different activities from other countries that are effective at producing them.
Assessments of cause and effect
It may well be that the very factors that allow countries to produce brains are the ones which reduce the opportunities for those brains to exploit the skills that they have developed in their home countries.
Crucial to this issue is the perception of the brains themselves. If they attribute their success to their own labours and that of the brain drainee country that allowed them in, then there will be a net loss to the brain drainee country, it may be less likely to see any future returns to its investment.
If however, the brains feel that they either owe a debt to the drainee country and/or that the drainee country offers opportunities in the long-term they may make a contribution to it.