At a structure level, this story is similar to A Study of Scarlet. There is the demonstration of Sherlock’s deduction method at the beginning of the story, followed by solving the crime and learning the story behind it.
One thing about Sherlock Holmes stories is that there is often some some positiveness out of a hideous crime. The positiveness may be in the form of “salvation”, “redemption”, or “justification”. For example, in A Study of Scarlet, the romantic story behind the crime may make some readers much sympathetic to the killer and in a sense his killings are justified.
But none of that was justified in The Sign of the Four – in this story, pretty much everyone involved in the crime met their fate deservingly so. From the very beginning of the Agra treasure, it was robbery/murder after robbery/murder, and everyone tempted by the wealth ended up incarcerated or dead. There is an ancient theme working here, i.e. money corrupts the soul. But on a deeper thought, Doyle may actually be alluding to the evil deeds committed by colonialism as a whole, where everyone benefited materially was a criminal and deserved nothing but punishment.
In this sense the Sign of the Four may well be the darkest Holmes story yet, but that does not mean that there wasn’t any positiveness. It is just presented in a different fashion. If the power of the treasure/money to corrupt can’t be stopped, a natural solution would be to get rid of the treasure all together, and that is exactly what Doyle did. By letting Small dumping all the treasure into the London water in a non-recoverable way, the purity/innocence of Mary, one of the “heir” of the treasure, remained intact. And also saved was her marriage with Watson.