The function is not too costly and difficult to implement, and sales covers the cost.
So looking at developing just a language filter, this is everything you're looking at:
> First you have to decide how you're going to go about doing it. Do we want to record new lines with non vulgar language or bleep things out?
> If recording entirely new lines, that's a lot of extra lines to record. Voice actors are not cheap. If you are doing this then you have to do this for EVERY language you support the game in, too.
> If bleeping them out, then you have to develop the system to detect and bleep those words. Pretty much all dialogue in the game is subtitled and those are stored as strings, so you can probably use that as an easy detection method.
> Then you need to develop the system that checks which setting you have and gives you the appropriate lines.
> Finally, there is testing it. It's worth noting that testing usually does not include just making sure that the switch is working for 1 or 2 lines and assuming that means it is working everywhere else. This is not the kind of feature you want messing up and turning off due to a bug.
> Fix any bugs you find during testing that you consider to be show stoppers, and then repeat the testing step.
Compare the cost of that against the number of purchases your marketing department believes you will gain in sales by adding in these features(minus whatever the retailers take). One has to image the people so offended by such content that they are not buying the game is a pretty small pool to begin with and even if you market that you have added such a feature(which costs more money) not everybody is going to know about it. A number of people will simply see the M rating and think it's unavoidable because they haven't been following the game's marketing.
The ESRB is not going to lower the rating just because the content is optional.
(and yes, I am a software developer =P)