4 But when he says, “The devil having now put into the heart of Judas Iscariot, Simon's son, to betray Him;” if one inquires, what was put into Judas' heart, it was doubtless this, “to betray Him.” Such a putting [into the heart] is a spiritual suggestion: and enters not by the ear, but through the thoughts; and thereby not in a way that is corporal, but spiritual. For what we call spiritual is not always to be understood in a commendatory way. The apostle knew of certain spiritual things [powers], of wickedness in heavenly places, against which he testifies that we have to maintain a struggle; and there would not be spiritual wickednesses, were there not also wicked spirits.
For it is from a spiritual being that spiritual things get their name. But how such things are done, as that devilish suggestions should be introduced, and so mingle with human thoughts that a man accounts them his own, how can he know? Nor can we doubt that good suggestions are likewise made by a good spirit in the same unobservable and spiritual way; but it is matter of concern to which of these the human mind yields assent, either as deservedly left without, or graciously aided by, the divine assistance.
The determination, therefore, had now been come to in Judas' heart by the instigation of the devil, that the disciple should betray the Master, whom he had not learned to know as his God. In such a state had he now come to their social meal, a spy on the Shepherd, a plotter against the Redeemer, a seller of the Saviour; as such was he now come, was he now seen and endured, and thought himself undiscovered: for he was deceived about Him whom he wished to deceive. But He, who had already scanned the inward state of that very heart, was knowingly making use of one who knew it not.
Source: Tractates on the Gospel of John (New Advent)