Being used with that API when there is permission to do such and being an example to help someone who is building a similar access to the API (with permission).
Also, TOR was funded with illegal uses in mind. Beneficial to the US government, perhaps even legal with the US, but illegal in their intended application.