レスありがとうございます

文末のin vainはなんとなくすっと意味がわかるんですが、文中にあると違和感を感じてしまって‥

He tried in vain to solve the problem.
He tried to solve the problem in vain.

2つの文に違いはありますか?