Investment, Externalities, and the Boundaries of the Firm