In some cases (and you left out marketing, which often exceeds the R&D costs). In other cases, the cost is directly related to 10% less than other treatments. Or to whatever the CEO thinks he can screw out of patients. See: Shkreli; Epipen.
Marketing is a red-herring. Sales and marketing should bring in more money than you spend on them or they're not worth doing. They exist to drive money This makes the company more profitable in the near term than R&D expenditure which can take decades to materialize.