Health care payers try to reduce costs by promoting the use of cheaper generic drugs. We show strong interrelations in drug prescriptions between the inpatient and outpatient sectors by using a large administrative dataset from Austria. Patients with prior hospital visits have a significantly lower probability of receiving a generic drug in the outpatient sector. The size of the effect depends on both the patient and doctor characteristics, which could be related to the differences in hospital treatment and heterogeneity in the physicians' adherence to hospital choices. Our results suggest that hospital decisions create spillover costs in health care systems with separate funding for inpatient and outpatient care.