What's the difference between the following two sentences?
Sam is back in Boston on a visit to his uncle.
Sam is back in Boston to visit his uncle.
What's the difference between the following two sentences?
Sam is back in Boston on a visit to his uncle.
Sam is back in Boston to visit his uncle.
There is only a slight difference in meaning between the two sentences. In many circumstances, people would express the same intended meaning with either sentence.
Sam is back in Boston on a visit to his uncle.
Here, visit is a noun, referring to Sam's entire stay in Boston. The sentence means that Sam's visit to his uncle is now in progress. Maybe Sam arrived before today and plans to leave on a day after today. Most likely, Sam is lodging at his uncle's house. None of these additional "maybe" and "most likely" statements is strictly implied by the sentence, but they are hazily suggested.
Sam is back in Boston to visit his uncle.
Here, visit is a verb*. The sentence means that the purpose for which Sam is back in Boston is to visit, i.e. meet in person with, his uncle. It suggests less strongly that Sam is lodging with his uncle. It suggests less strongly that Sam has already met in person with his uncle. Perhaps Sam just arrived by plane and hasn't reached his uncle's house yet. Perhaps Sam's uncle is dead and Sam doesn't know it yet. Since the sentence only states Sam's purpose for traveling to Boston, it much less strongly implies that Sam is successfully fulfilling that purpose. Unlike the first sentence, this sentence does not mean that the visit is actually in progress.
* Strictly speaking, it's an infinitive verb, which is a verbal noun.
"...on a visit..." is really a contraction of "...while on a visit..."
The difference between the sentences is very subtle. The first one implies that Sam happens to be in Boston because he is visiting his uncle, while the second one implies that the reason Sam is in Boston is to visit his uncle. But the difference is almost without distinction.