The ring gear replacement requires the transmission to be removed, as well as the flywheel so the old, damaged one can be removed and a new one pressed on. I have had this done on my 1982 240D, and the ring gear was not the expensive part. While the transmission was out I had all the clutch (manual transmission) stuff replaced as the car had over 120,000 miles on it at the time.
The labor to get to the ring gear was several hundred dollars a few years ago. I imagine it is on the same order of magnitude today. The gear was under a hundred dollars as I recall and the job took less than a day.
I agree with the diagnosis noted earlier in this string. The engine always stops in one of four positions (assuming it is a four cylinder) and those spots get worn faster than the rest of the teeth on the gear. As the car ages, it will start to favor one or two positions (compression differences between cylinders) and the rate of wear increases accordingly.
Any good Mercedes shop should be able to handle the job, but I had it done by the dealer as where I live there are relatively few Mercedes specialists. Jim
1986 Euro 190E 2.3-16 (291,000 miles),
1998 E300D TurboDiesel, 231,000 miles -purchased with 45,000,
1988 300E 5-speed 252,000 miles,
1983 240D 4-speed, purchased w/136,000, now with 222,000 miles.
2009 ML320CDI Bluetec, 89,000 miles
1971 220D (250,000 miles plus, sold to father-in-law),
1975 240D (245,000 miles - died of body rot),
1991 350SD (176,560 miles, weakest Benz I have owned),
1999 C230 Sport (45,400 miles),
1982 240D (321,000 miles, put to sleep)