When a company begins an expensive research project, they don't know beforehand if it will be profitable or not.
If little-to-medium pharma were compensated generously for the risks they take, they would make more research in new drugs, but because the risk is not compensated, only big pharma can afford the research.
It's not like if it weren't for the evil pharma companies, everyone would have access to advanced medicine. Quite the contrary, in fact.
We are not talking about software here. Developing medications requires huge investments in developed countries, and no one will develop in the other countries because there is no patent protection in those countries.
We need to incentivize research into important medicine (ie antibiotics, or something to actually cure AIDS and malaria for good), which is hard because as soon as they develop something actually useful, people refuse to honor their patents.
That means research into important drugs like antibiotics, HIV and malaria medicine is underfunded.
Ofcourse from the big pharmacy side, the generics represents lost opportunities, they want to make more money.
Well pharma companies tend to spend so much money because they are run very inefficiently in the first place. Plus there's the cost of lobbying...