They are part of thr final cost when they are part of the utility of the investment. If they are part of the utility or not depends largely on the laws.
For example if there is a huge fine for enviromental damage then causing such damage has significantly decreased utility and as such the market will price itself to avoid enviromental damage.