"John threw Mama from the train a kiss." This statement is used as an example of poor syntax. It sounds as if John threw Mama off the train, followed by a kiss. How would one arrange this statement into a syntax that expresses John's action correctly?
You can rearrange the words, or change the words (as one answer does) to make many different sentences with non-poor syntax.
The question is What do you want the sentence to mean?
When you know that, you can rightly order the words
Since John is the one doing the action, per the last sentence of the OP, then my favorite is
John threw the train a kiss from Mama.
John threw a kiss to his mama/mother on the train.
Assuming this isn't a reference to the movie, "Throw Mama from the Train"
Throw a kiss <-- generally means to kiss the palm of your hand and figuratively toss it to the recipient.
Looking at TRomanos answer and rereading the OP's sentence, it is a bit ambiguous who is on the train because of the syntax. To me, it looks as though Mama is on the train. "...Mama from the train..." and your follow up statement, "It sounds as if John threw Mama off the train" makes me believe so.
Where TRomano's answer suggests that John is on the train. "From the train, John threw a kiss to mama."