Is it legal to sell cracked gaming accounts?
Usually not. Your mention that "[i]t clearly goes against the terms of service" purportedly refers to a prohibition to deliver credentials to access the game. It is otherwise impossible to address specific ramifications without a detailed knowledge of the terms of service.
As for your follow up comment, the agreement primarily is between the company and the licensee. However, the licensee's breach of contract (here, the unauthorized distribution of credentials) does not void the company's rights on its product with respect to everyone else. At the very least, the company would have a viable claim of unjust enrichment wherever a non-party to that initial contract obtains the product without making the corresponding payment to the company.
Furthermore, proving that the non-party knew or should have known the terms of service would establish the non-party's mens rea, and/or his breach of [an independent] contract. This independent contract is formed when the new user installed and/or accessed the product using the rogue credentials. Formation of contract occurs during the common practice that the terms of service are presented to the user when installing the product or doing the account settings, and that user accepts those terms in order to proceed with the setup.