In many areas of health care financing, there is controversy over the sources of cost variability and about the respective roles of inefficiency versus legitimate heterogeneity. This paper proposes a payment system that creates incentives to increase hospital efficiency when hospitals are heterogeneous, without reducing the quality of care. We consider an extension of Shleifer's yardstick competition model and apply an econometric approach to identify and evaluate observable and unobservable sources of cost heterogeneity. Moral hazard can be seen as the result of two components :long-term moral hazard (hospital management can be permanently inefficient) and transitory moral hazard. The latter is linked to the manager's transitory cost-reducing effort. For instance, he or she can be more or less rigorous each year when bargaining prices for supplies delivered to the hospital by outside firms. The use of a three-dimensional nested database makes it possible to identify transitory moral hazard and to estimate its effect on hospital cost variability. Econometric estimates are performed on a sample of 7,314 stays for acute myocardial infarction observed in 36 French public hospitals over the period 1994–1997. We obtain two alternative payment systems. The first takes all unobservable hospital heterogeneity into account, provided that it is time invariant, whereas the second ignores unobservable heterogeneity. Simulations show that substantial budget savings—at least 20%—can be expected from the implementation of such payment rules. The first method of payment has the great advantage of reimbursing high-quality care. It leads to substantial potential savings because it provides incentives to reduce costs linked to transitory moral hazard, whose influence on cost variability is far from negligible. This payment rule could be extended to other areas of health care financing, such as Adjusted Average Per Capita Cost to calculate Medicare Managed Care reimbursements in the United States.