the primary difference here is that all stars racing is not set specifically in the context or universe of the sonic franchise
you could say it's a sonic game because sonic is in the title and it has sonic characters and sonic levels, but it also has characters and levels from other sega franchises in a way that isn't "guest starring," they're all sharing the game, and thus, it's not a sonic game in the regard of focus either. in mario kart 8, all the characters are from mario games. you can one way or another use characters that aren't from mario, but that's considered extended content; they are guests in their show. the focus is exclusively on mario but they throw in goodies for people that enjoy other franchises as well.