First, there is "bolt hole" compatibility with all M102/M103/M104 engine and transmission pieces. Meaning, you can take a trans from a W124 300E twincam six and attach it to a 1983 M102 engine in a W201.
To really make it work, you'll need the flywheel and torque convertor to match the motor and all the varioius bits. You'll also need the proper length driveshaft depending on the combination.
As for the cost of rebuilding a 722.4xx automatic transmission, prices will vary on the degree of rebuild, but expect that a rebuild with all the new steel, gaskets, seals, torque convertor, modulator and other bits to run roughly around $1K, parts and labor.