For Saint Thomas Aquinas, the essence of lying (lying is always immoral for him) has nothing to do with the intention to deceive (Summa Theologica II-II q. 110 a. 1 co.):
Accordingly if these three things concur, namely, falsehood of what is said, the will to tell a falsehood, and finally the intention to deceive, then there is falsehood—materially, since what is said is false, formally, on account of the will to tell an untruth, and effectively, on account of the will to impart a falsehood. However, the essential notion of a lie is taken from formal falsehood, from the fact namely, that a person intends to say what is false; wherefore also the word mendacium [lie] is derived from its being in opposition to the 'mind'.
And for Aquinas, the intention to deceive is not necessarily against charity/love to the neighbor, either (ibid. a. 4 co.):
A lie may be in itself contrary to charity by reason of its false signification. For if this be about divine things, it is contrary to the charity of God, whose truth one hides or corrupts by such a lie; so that a lie of this kind is opposed not only to the virtue of charity, but also to the virtues of faith and religion: wherefore it is a most grievous and a mortal sin. If, however, the false signification be about something the knowledge of which affects a man's good, for instance if it pertain to the perfection of science or to moral conduct, a lie of this description inflicts an injury on one's neighbor, since it causes him to have a false opinion, wherefore it is contrary to charity, as regards the love of our neighbor, and consequently is a mortal sin. On the other hand, if the false opinion engendered by the lie be about some matter the knowledge of which is of no consequence, then the lie in question does no harm to one's neighbor; for instance, if a person be deceived as to some contingent particulars that do not concern him. Wherefore a lie of this kind, considered in itself, is not a mortal sin.