Why do pharmaceutical companies make drugs? Profit, like all other companies. They make profit by selling drugs for more than it costs to produce them.
Some products require lots and lots of up front costs, but little additional cost. Microsoft's Windows operating system is an example. Microsoft spends millions of dollars on highly paid engineers to write the software before they sell even one operating system. Once the software is written, it doesn't cost much to transfer it onto a CD. At this point, the marginal cost of production (i.e. the cost to produce one more) is very low. Microsoft must charge a price high enough to recoup the marginal cost of production and the up front investment. This is why we have patent laws. Patent laws prevent other companies from stealing Microsoft's up front investment.
The pharmaceutical industry works in the same way as the software industry. Companies pay scientists millions to develop drugs before a single dose is made. Once the formula for the drug is developed, the marginal cost of producing it is very small.
Let's say some company developed a drug that cured cancer. If they want to make a profit or break even, they would have to charge a price that far exceeds the marginal cost of production. Economically speaking, this is indisputable.
Politically, we have a problem. We have a drug that cures cancer but there will be some people who cannot afford it. These people, they'll say, will die because of greedy capitalists. The drug should be free to all those who need it. What kind of society let's people die because they don't have the money? Not this one. Inevitably, politicians will impose price controls or outright force companies to give the drug away.
Reality is that the drug cannot be developed without paying for it. Paying for it requires recouping the costs. If those costs are not recouped, the drug will not be developed.
Cancer is an extreme example, but we have many new drugs which only exist because we pay for them. Government can be very successful at bending the cost curve down. All they have to do is not pay for things. It's a fallacy to think lives are only lost when greed prevents someone from receiving the latest drug. Far more lives are lost when the latest drug doesn't exist.