You have no idea what the priest actually said, as you are getting this second hand from your personal friend who has already established that they (a) were cheating on their spouse, (b) were and apparently are still lying to their spouse about the cheating (I see no indication spouse has found out even as of now) and (c ) even after allegedly seeing the priest multiple times about the behavior, did not end the affair and only did so when a family member threatened to blow the whistle. This person sounds about as reliable as a broken crutch and I would not believe anything they told me at this point.
Second of all, even on the remote chance the priest said this, perhaps he was misled by this untruthful person into thinking “not telling” was the best course of action, for example if lying cheating person had told the priest the affair was over or soon to be over, or had told the priest that spouse was physically fragile and might keel over of a heart attack if told, etc.
It sounds like your friend is trying to pass the blame to a priest for their own failure to own up to their behavior. “I couldn’t tell, the priest told me not to!” Yeah right buddy.