What is it about these two sentences which gives
rise to the different meanings? After you have made up your mind, compare
your answer with ours.
Our answer
These two sentences have the same grammatical structure. But
they mean different things because the two words (or, more accurately,
the two one-word phrases) 'John' and 'Mary' have different grammatical
functions in the sentences, as we indicate below:
NP
VP
NP
Subject
Predicator
Object
John
kissed
Mary
Mary
kissed
John
Thus we can see that the position of the NP before or after the predicator
changes its role (from subject to object and vice versa).