I always saw Sonic as more mature and darker than Mario since 1991
Well, actually Tails was the first realization of this aspect.
I still laugh when I and my friends (two fraternal twin sister, just few months younger than me) were talking about Dr Eggman:
The twins: 'Here comes the mad scientist!' Me: 'Is he evil?' The twins: 'No' Me: 'So, what he wants to do to Sonic?' The twins: 'Kill him' Me: 'then, he IS evil!'
I didn't think much about that back then. many of my favourite cartoons contained dark scenes. In the Smurf there were episodes where they talked about death sencences, animal cruelty (shown), even racism sometimes. And weapons. Those were pretty normal stuffs in kids cartoons.
Although in a kid friendly way, if the animal was hurt, once saved it remained hurt and had to be cared through recovery, it didn't magicallly heal.
Then Tails came
What caught my attention were his twins tails. The obvious representation of diversity through design that wasn't the usual 'guy/gal in weelchair who turns out to be a Mary Sue'. I think a different kind of diversity that is often overlooked.
Tails was a child, he was flawed, he could do things Sonic could not but he also could do not do things Sonic could do, and he was very unexperienced. His twin tails gave him advantages but only to a degree. you could love him or hate him easily because he was made to be relatable, not to be loved or hated by everybody.
Well, since my understanding was low and i also was also a child, i assumed tails got two Tails after Eggman experimented on him, and somehow he escaped from his clutches (helped by Sonic most likely).
I though also Sonic could be an experiment of sort, with his blue fur, his speed and his vaguely feline face despite being a hedgehog. I wonderd how gruesome the experiment were. Especially because Sonic series also showed actual beasts, like Pocky, Flicky etc...
Sonic SatAM also was quite dark, when people were turned into robots by Eggman (who truly was evil, and who also had some accident woth his own inventions that left him scarred forever), the struggle, the fear was shown.
Sonic's tears
Mandates existed. Also in the past. All side materials what were sold - cartoons, comics etc were all SEGA approved after being supervised, including Sonic SatAM, Aosth, Sonic Underground, Archie comics etc...
But Sonic could cry, how?
Well, mandates before Iizuka were way looser and used to leave a great room of freedom to all Sonic authors. Archie comics also had lots of scenes with Sonic crying, all supervised and approved. Latest time Sonic was seen crying was in Sonic Adventure 2, then in Sonic Prime, but it had to be contained (By the time of Adventure 2 it was Maekawa's deliberate choice. Mandates were still loose. With Sonic Prime Sonic had to hold back).
Tears of grief
Here the former limits of mandates about sonic crying, tears are there and the sadness is still convincing.
Today you have to be sneaky for this. Sonic is not being tsundere here but is showing the emotions of another character who linked with Sonic before and that can't cry for obvious reasons. Noticed how casual Sonic's expression is. They even needed to underline that Sonic never cries, doesn't matter what, through dialogues.
So cold...
if it was made in the early 2000s I would have seen more emotion in this scene. This is after Sonic's friends saves Sonic from cyber corruption. If he is sure he can save them, he isn't supposed to cry, but at least look more worried.
In Sonic 2 for Sega Master System, in one of the two endings, Tails dies. and Sonic looks up the sky, remembering him.
Familiar, uh?
Sonic doesn't always have to be dark. He works well with light hearted things. But he is part of a context were death and violence were shown from the start
Sonic didn't look always happy and used to have lots of Shadow vibes and attitudes in certain situations.
Mario
Mario, though seen as Sonic rival game mascotte, was something different. It was never dark. All characters have a pudgy look and are joyful. Even the villains are quite hilarious. they may be treatening but they aren't nearly as seriously evil and cruel as Dr. Eggman
Anything was shown to be light hearted and humorous. Mario's exaggerated Italian accent, parodies of well known fairy tales and movies (King Kong, the various fairy tales with the princess in distress) everything turns happy and sad scenes are never intense.
This is the darkest thing in Mario. And is hilarious.