Why stop at medicine? Why does anyone get to have enforcable patents in "poor countries", make a profit, etc. etc. Do you also know people can buy the medicine in "poor " countries for free then, and just ship it back to the "non poor"?
The problem you probably mean can be avoided by giving the license to selected companirs only, and gating access to the drug through healthcare providers.