I don't like change!
JavaScript (ES6), 413 ... 343 342 bytes

Saved 5 bytes by tweaking the loop indices, as suggested by @KevinCruijssen

Takes input as 2 strings in currying syntax. Returns an array of 3 strings.

b=&gt;a=&gt;{m=[];x=a.length;y=b.length;for(i=j=0,c=d='';i&lt;=y;c+=R='R')m[i]=[[c,i++]];for(;j++&lt;x;)m[i=0][j]=[d+=A='A',j];for(;i&lt;y;i++)for(j=0;j&lt;x;)[C]=m[[X,S]=m[i][j],[Y,I]=m[i+1][j],[Z,D]=m[i][++j],Q=[Z+R,D+1],i+1][j]=b[i]==a[j-1]?[X+' ',S]:S&lt;I?D&lt;S?Q:[X+'M',S+1]:D&lt;I?Q:[Y+A,I+1];return[(g=s=&gt;C.replace(/./g,c=&gt;c==s?' ':b[i++],i=0))(A),g(R,b=a),C]}


Test cases



let f =

b=&gt;a=&gt;{m=[];x=a.length;y=b.length;for(i=j=0,c=d='';i&lt;=y;c+=R='R')m[i]=[[c,i++]];for(;j++&lt;x;)m[i=0][j]=[d+=A='A',j];for(;i&lt;y;i++)for(j=0;j&lt;x;)[C]=m[[X,S]=m[i][j],[Y,I]=m[i+1][j],[Z,D]=m[i][++j],Q=[Z+R,D+1],i+1][j]=b[i]==a[j-1]?[X+' ',S]:S&lt;I?D&lt;S?Q:[X+'M',S+1]:D&lt;I?Q:[Y+A,I+1];return[(g=s=&gt;C.replace(/./g,c=&gt;c==s?' ':b[i++],i=0))(A),g(R,b=a),C]}

console.log(f('ABCDEF')('AFBECD').join`\n`);
console.log(f('This_is_an       _example_text')('This_is_a_test_as_example').join`\n`);
console.log(f('AaAaABBbBBcCcCc')('abcABCabcABC').join`\n`);
console.log(f("intf(){longr=java.util.concurrent.ThreadLocalRandom.current().nextLong(10000000000L);returnr&gt;0?r%2:2;}")("intf(){intr=(int)(Math.random()*10);returnr&gt;0?r%2:2;}").join`\n`);
console.log(f('ABCDEF')('XABCDF').join`\n`);




Less golfed

b =&gt; a =&gt; {
  m = []; x = a.length; y = b.length;

  // initialize the leftmost column and the topmost row
  for(i = j = 0, c = d = ''; i &lt;= y; c += R = 'R')
    m[i] = [[c, i++]];
  for(; j++ &lt; x;)
    m[i = 0][j] = [d += A = 'A', j];

  // walk through the Levenshtein matrix
  for(; i &lt; y; i++)
    for(j = 0; j &lt; x;)
      [C] = m[                                // C = current string, once updated
        [X, S] = m[i][j],                     // substitution
        [Y, I] = m[i + 1][j],                 // insertion
        [Z, D] = m[i][++j],                   // deletion
        Q = [Z + R, D + 1],                   // precomputed update for deletion
        i + 1
      ][j] =
        b[i] == a[j - 1] ?
          [X + ' ', S]                        // unchanged character
        :
          S &lt; I ?
            D &lt; S ? Q : [X + 'M', S + 1]      // deletion or substitution
          :
            D &lt; I ? Q : [Y + A, I + 1];       // deletion or insertion

  return [
    // g = helper function to format the output strings by inserting spaces
    (g = s =&gt; C.replace(/./g, c =&gt; c == s ? ' ' : b[i++], i = 0))(A),
    g(R, b = a),

    // final modification string, picked from the last visited cell
    C
  ]
}


Example

Below is the initial matrix for b = "foo" and a = "ok":

//                     'o'           'k'
[ [ [ '',    0 ], [ 'A',   1 ], [ 'AA',  2 ] ],
  [ [ 'R',   1 ],  (undefined),  (undefined) ],  // 'f'
  [ [ 'RR',  2 ],  (undefined),  (undefined) ],  // 'o'
  [ [ 'RRR', 3 ],  (undefined),  (undefined) ] ] // 'o'


and here is the final matrix after all iterations:

//                     'o'           'k'
[ [ [ '',    0 ], [ 'A',   1 ], [ 'AA',  2 ] ],
  [ [ 'R',   1 ], [ 'M',   1 ], [ 'MA',  2 ] ],  // 'f'
  [ [ 'RR',  2 ], [ 'R ',  1 ], [ 'R A', 2 ] ],  // 'o'
  [ [ 'RRR', 3 ], [ 'RR ', 2 ], [ 'R M', 2 ] ] ] // 'o'


The final modification string along with the Levenshtein distance are stored in the bottom-right cell.