You are confusing cost and price. The price is what it is because US patent law gives them exclusive use of their intellectual property which allows them to recoup the cost. But other countries don’t. So the price is low. That doesn’t make the same drug produced elsewhere inferior.
You are the one who is confused. The cost of drugs is not simply the production cost. The production cost of most drugs is essentially zero. It is negligible compared with the cost of approving new drugs for sale. The price must also allow recovery of all of the costs associated with the drug development. You are simply discussing the production costs.
A complicating factor is the fact that the patent must be issued long before the drugs are approved for sale. This leaves far less time for the development costs to be amortized before the patent runs out. Longer patent protection times would actually REDUCE the consumer price of the drugs.