So pretending to be a 12 year old girl to catch a child predator is illegal then?
A detective doing undercover work may require a degree of duplicity to achieve their aim, their authority as an officer is not what gets you to believe their lie, they almost always conceal that fact from you.
I think these are clearly distinct arenas of law enforcement.
reading some of the criticisms of their former behavior does highlight pretty strongly why exactly that kinda thing is problematic.
--your source
Not as straightforward as you're implying.