Let me jump into the conversation and start by saying I am not against profits, and even substantial profits by pharmaceutical companies and the medical industry in general.
That being said, the continued solvency and productivity of Gilead is not my concern, and the amounts they are charging for this drug are obscene.
Let's draw an analogy. A hospital in a decaying urban area is failing financially. One day, a wealthy man is wheeled into the ER in cardiac arrest. The ER doctors save the man's life, and charge him $1 million, arguing that substantial institutional overhead and this man's ability to pay mean that if the hospital is to remain solvent and productive, they need to charge some people huge amounts. Would anyone defend this practice as fair?
If Sovaldi was not a lifesaving drug... if it was like Viagra or Propecia or something, I would have no problem with them charging as much as they liked. But people with Hepititus C have no reasonable alternative, and people will spend unlimited amounts to save their lives.
As for the specific method to determine the price of the drug, I think it's pretty straightforward. Make the drug companies establish a research/testing/approval/production cost that is attributable only to that drug, and then allow them to apply a multiplier to that cost that bakes in subsidies for failed projects, and profits to shareholders. Drug companies that are well managed and generate good drugs consistently will still outperform other drug companies, and those that do not can't just charge obscene amounts for their good drugs to subsidize their poor management.