Were it not for a (probably illegal in this case) monopoly, other people would be able to make that same pill for $5 per tablet. And then nobody would pay $50 for the pill.
Supply and demand IS NOT the same as "charging everyone as much as they will pay for everything". It's inherently unfair to everyone who has to buy that thing, and that's why people think it's a rip-off, because it is.
[edited to remove some hyperbole]