With regard to the sentences with  and with Mari-no koto-o 'Mary's matter' in (20a), they are synonymous, although it seems that the latter is a more indirect way of expressing what the former means.
we conclude that o in (19) is the contraction of no koto-o in (20a).