Guro and snuff are legal, because on some level we accept that it's not real, that no one is being harmed, and that liking it doesn't make you a literal murderer or psychopath. Lolicon is not illegal, because liking it automatically makes you both a pedophile and child rapist.
There's multiple parts to that question but without getting into a massive off topic discussion I'll restrict myself to a few key points. Broadly in human society we accept violence in the extreme as fiction. We would have to dissect that first. We have also become more open in modern society to accept a greater degree of sexual expression and even pornography. Of note neither fictional sex or violence is legal everywhere. In some cases authorities have simply turned a blind eye to enforcement. The combination of the two is still not widely accepted; and there is psychologic discussion that joining the two together is dangerous and unhealthy. However, without making the two categories of sex or violence illegal it would be tough to make the combination of the two illegal without explicit definition. The subject would have to be brought to light- I doubt there's much appetite for discussion- and rational arguments would need to be presented.
Second, because most guro is surrealistic it cannot be considered a depiction of a real act. Most of the stuff that happens can never happen because it violates things such as the laws of nature. It doesn't take much critical analysis to understand that people who are shot don't end up tidy little holes; people who are chopped in half don't look like they've been cut in half by a laser beam; and guys don't spray a massive cum fountain when they're killed with their dicks hanging out. In many cases we use our imagination and our willingness to suspend disbelief to perceive what we want out of sexually violent artwork.
Loli on the other hand is illegal because its another means by which sexual deviancy exacted towards a minor can be manifested. Its less so about looking at it from the perspective of art but rather a means to prevent perpetrators such a pedophiles and rapists from turning to another avenue to fuel their desires. Basically real people performing real acts on real people have ruined it for anybody that would seek to view these works as art. Classically nudes in all forms existed in more pure incarnations. But without proven artistic merits any depiction involving nude children would be unacceptable by modern society.
Not that complicated. The only reason lolicon manga *can be* illegal is because the common law system tend to define stuff kinda vaguely and let judicial discretion do the rest of the job. The judge can either argue that fictional pedophile impacts reality, or that fictional stuff hurt no real people. Both are possible but depends on where you live in.