Exploiting probably isn't illegal, but as soon as you begin to use these exploits against other people to access their data it is illegal. So selling the exploit or performing it for clients would mean assisting someone in breaking the law.
They probably aren't going to get in trouble since their clients are often government agencies themselves.
You are writing this on “Hacker News”. Maybe you should rephrase that.
unlocking a carrier-locked phone under contract
-vs-
unlocking a carrier-locked phone out of contract
-vs-
unlocking a phone (password or fingerprint locked)
-vs-
unlocking a phone stolen/you don't own (hacking)
However most countries can authorize law enforcement to access the device under various conditions (for example a warrant). So while the owner of the device doesn't authorize accessing the device, the law allows the police to access it.