We investigate second-best, input-based taxes for agricultural nonpoint pollution control when market prices are endogenous and production is heterogeneous. Theoretically, we derive the optimal forms of taxes which take account of heterogeneity (non-uniform taxes) and a tax which does not (a uniform tax). Empirically, we use a multi-factor, market-equilibrium simulation model to determine optimal tax rates and associated equity effects, particularly differences in landowner gains/losses across a heterogeneous region. When market prices are endogenous, second-best tax policies result in pecuniary externalities that affect existing environmental externalities. In particular, the pecuniary externalities amplify the effect of producer heterogeneity on determination of sub-regional differences in tax rates and returns to land, particularly for the uniform policy. With endogenous prices, the uniform tax rate is considerably higher than any of the non-uniform rates and, ironically, the non-uniform taxes result in less dispersion of landowner gains across sub-regions than the uniform tax.