While it might be 20 years, with the possibility of additional exclusivity, the clock starts when the patent is filed, not when the drug is approved and available for sale. It can take 10 years for a drug to make it to market after that clock starts ticking. Pharma companies have become more efficient at getting drugs to market and extending that exclusivity period, but it rarely lasts more than 12 years. That's part of the reason that there is a shift towards manufacturers developing biologics: the regulatory landscape in the US only just began allowing for biosimilars and the barrier to entry is very high. Barrier to entry for a generic small molecule is very low.
As for how well the system functions, we only need look at countries with single payer systems to understand what is wrong with pharmaceutical pricing in the US. The US govt is not allowed to negotiate prices with drug manufacturers. Medicare and Medicaid can choose not to cover a drug, but they can't be involved in setting the price. Contrast that with Germany, where there is a formula to determine the price of a new drug based on how much more efficacious and safe it is than the standard of care (not placebo). Not better than drug X? Then it can't cost more than drug X, possibly less, if it is even approved.