The cost of medications is, in fact, generally to make up for the cost of developing the medicine. Drug companies DO make money, but not as much as insurance companies. It regularly costs BILLIONS of dollars to develop one drug. One. It includes basic research, intermediate research, and clinical trials (three, at least). And it doesn’t include the costs of failed drugs, most of which never get past the intermediate stage, let alone through clinical trials. Without expensive medicines, there would be no cheap, effective, or safe ones.
The cost of drugs increases at hospitals because they need to make up for those that do not have insurance and don’t pay at all, or those that do have insurance and insurance denies coverage. It is very expensive. Doctors are supposed to be ethically tied to their patients–never do harm. Which means that often, people are treated and there’s no way to pay. Too often, they actually are insured, but as others have mentioned, it’s up to the insurance company to decide what’s “necessary” and what’s not.