We examine the heterogeneous relationship between the adoption of electronic medical records (EMR) and hospital operating costs at thousands of US hospitals between 1996 and 2009. Combining data from multiple sources, we first identify a puzzle that has been seen in prior studies: Adoption of EMR is generally associated with a slight increase in costs. We draw on the literature on information technology as a business process innovation to analyze why this average effect arises, and explain why it masks important differences over time, across locations, and across hospitals. We find evidence consistent with this approach, namely, that: (1) EMR adoption is initially associated with a rise in costs; (2) EMR adoption at hospitals in favorable conditions – such as urban locations – leads to a decrease in costs after three years; and (3) Hospitals in unfavorable conditions experience a sharp increase in costs even after six years.