In Chapter 1080 Aokiji explained what SWORD is to Blackbeard. Aokiji is obviously a member of SWORD. Yet Blackbeard is keeping Aokiji in his crew anyway.
This seems to be tripping people up because they assume this means that Blackbeard doesn’t know Aokiji is in SWORD.
Here’s the thing though. Blackbeard knows. And Aokiji knows he knows. And Blackbeard knows Aokiji knows he knows…. You get the idea.
But both of them are pretending they don’t know, because it’s more useful to them that way.
From Blackbeard’s perspective, Aokiji is a spy, but he’s a spy that Blackbeard knows about. Which means he can prevent Aokiji from getting his hands on any truly dangerous information while using him as muscle.
From Aokiji’s perspective Blackbeard knows he’s a spy, but the fiction of being on Blackbeard’s team gives him freedom of movement to perform his goals without being seen as a member of the World Government and gives him the ability to move through Blackbeard’s territory (and spy on things) with impunity.
Each of them is walking a careful tightrope, betting that they can use the other better than the other can use them.