A big part of the high price of drugs is that the pharmaceutical companies have essentially a mad dash to recoup the (m/b)illions of dollars spent on R&D and clinical trials. Patent process has to begin once the target is discovered (e.g. assayed). Now you have to do further assays (0.5-1y), non-clinical safety studies (0.5-2y), route scouting and scale up (a few months), several years of clinical trials, then scale up the process to manufacturing. You've just burned 5-8 years of your patent protection. You have 15 years or less to recoup the cost of not only this drug, but all others that failed to get through the pipeline (which can be as much as 5-to-1).
Once it goes off patent, 80% of the sales of brand name can vanish [1]. Getting a generic approved is a fraction of the time and cost as getting the original through the pipeline. It's like P vs NP, since the FDA approval means publishing pretty much a how-to guide (synthesis route) and much of the safety data. You just have to demonstrate "our stuff is the same as the proven stuff".
I've long been a proponent of "15 years from FDA approval" - this gives a reliable, predictable cushion, without having to predict clinical failure rates. More time can be spent on safety studies (NCSS) and less costly Phase I and II trials, ideally leading to safer and more effective drugs. There is still pressure to move quick, because as soon as the clinical trials start, other companies have access to the leads you are looking at, and can simulate the structure and look for similar leads.
[1]https://www.forbes.com/2002/05/02/0502patents.html