Not to defend the costs or the state of the system, but the justification for the prices of medications in hospitals usually includes the time of the nurses, pharmacists, and techs that make the whole administration process happen safely.
Also, hospitals will bill whatever amount they can get reimbursed. Most insurance companies have contracts with hospitals where they only get a fraction of the billed amount. The rest is written off by the hospital. Uninsured patients can usually work out payment plans for lower amounts as well. That said, healthcare in the US is still pretty damn expensive.