Hi. Thank you for raising such an interesting question. I found it quite interesting for some discussions.
First, I would say that the meaning of those questions (in terms of the interrogative adverb) has inverted because of the presenting way of the verb conjugation, rather than the change of order. As a result, by taking the indicating present tense of the verb "love", the first question makes the interrogative adverb (who) to be the SUBJECT of the question; whereas by using the auxiliary verb "do" on the verb "love", the second question makes the interrogative adverb (who, again) to be the DIRECT OBJECT of the question. That is cool. :)
Well, if you want to avoid confusion, you may also adopt the interrogative adverb "whom", which is the object (accusative/dative) case of "who", when you pose similar questions. For instance,
Who loves Mary? -- The person in question is in nominative case (i.e., the subject).
Whom loves Mary? (OR: Whom does Mary love?) -- The person in question is in accusative case (i.e., the [direct] object).
Another way to convert the interrogative adverb "who" into a direct object is to use a subordinate clause. For instance,
Who is the person that Mary loves?
This may look a bit clumsy, but it works out fine.
As a brief note, this interesting question additionally reminds me the concept of "personal 'a' " in Spanish language, where it is generally adopted even in the direct object of a person (except for certain verbs), and hence, there would be no confusion when applying the above question. On the other hand, German, Russian, etc. also do not have such confusion due to the fact that they adopt the case declensions.
Well, I do not know if I have answered and commented properly, but anyway, good day. / 祝 是日安好。