Economies with externalities: regulation and incentives