Hydrocarbon turns into CO2 (and CO) and H2O when burned (plus H, H2 and C when too rich). Since density of diesel is about 12% more than that of gas, a litre of diesel produces 12% more CO2 than a litre of gas when burned.
So, if we compare a 10 litres/100km gas automobile and a 7 litres/100km diesel automobile, we cannot say the diesel emits 30% less CO2. It is more like 22% less. Still it is good, which is due to higher thermal and mechanical efficiency of the diesel engine.
As for the cost difference let’s see the price difference between 335i and 335d… Do we know the price of 335d? With its sturdier construction, more complex fuel injection system, more expensive cat converters and DPF in addition to the urea container and spray system plus the amortization of years of R&D to clean it, definitely the diesel engine costs much more than the gas counterpart. If BMW keeps the price differential around 3000 dollars, which should be the maximum marketing wise, BMW is making less money by selling the diesel model.