This paper analyses theoretically and empirically issues in optimal pricing with excess hospital capacity, and then applies the analysis to the issue as to whether Medicare and Medicaid payments cover the marginal costs of treating patients of each type. The primary innovation of this paper lies in incorporating appropriate theoretical measures of hospital excess capacity to a multiproduct empirical hospital cost function, and in showing how proper measures of marginal cost can be applied to the examples of Medicare and Medicaid reimbursement in California. With a standard translog specification that ignores hospital excess capacity, the estimated marginal costs of Medicare and Medicaid patients are higher than the reimbursement. However, correctly incorporating excess capacity into our model leads to considerably lower estimates of short-run marginal costs, suggesting that Medicare hospital reimbursement is more than adequate in the short run. We also develop a third marginal cost concept, that of what long-run marginal costs would be ifexcess capacity were eliminated. This is the most theoretically appropriate measure of optimum long-run reimbursement; Medicare reimbursement also covers this measure of costs. The extent to which Medicare reimbursement covers costs thus depends crucially on whether capacity is assumed fixed or variable. Similar examples are presented for Medicaid.