Much of the development cost of a new drug is paid by the US market (yes, this is why you pay higher prices than most Europeans do) meaning that as long as drugs in, say, Greece are sold at above the marginal cost of production they still make a profit.
FORBES: Drug Dealing: Free Markets and Price Fixing Just Don't Work Together