Many activities are subsidized despite generating negative externalities. Examples include needle exchanges and energy production subsidies. We explain this phenomenon by developing a model in which the policymaker faces constraints or costs. We highlight three examples. First, it may be optimal to subsidize a harmful activity if the policymaker cannot set the first-best tax on an externally harmful substitute. Second, it may be optimal to subsidize a harmful production process if the activity mix at lower levels of output uses more harmful activities than the activity mix at higher levels of output. Third, it may be optimal to subsidize a harmful activity if there is a large administrative cost associated with taxing a harmful substitute. We also show how the functional form of the cost of administering a Pigouvian tax affects the optimal tax. When administrative cost is a function of only tax rates, the policymaker should tax each activity. However, an increase in the tax presents a tradeoff: lower externality, but higher administrative cost. A subsidy may be optimal for some externally harmful activities. When administrative cost is a function of only activity levels, it may not be optimal to tax every activity. If it is optimal to tax all of the activities, the policymaker should set the tax equal to the externality plus the marginal administrative cost. If it is not optimal to tax every activity, the complementarity between activities comes into play and it may be optimal to subsidize externally harmful activities