For me it's 64 > 3D World > Sunshine > Galaxy
SM64 has aged terribly, we all know that. Even back when it was released the camera was a nightmare and it's only gotten more aggravating over time. But Mario moves so fluidly that it just makes the game so much fun to play. The level design isn't all that great a lot of the time, but it at least stays interesting and allows for a lot of flexibility in the way the game is played and the order the levels are taken. I'm sure a lot of my love for it is nostalgia goggles, but it really is just a joy for me to play it.
3D World gets a lot of flack from people saying it's just 2D Mario in a 3D environment. Well... yeah! It doesn't have the exploration of 64 and Sunshine, but that's okay. It's just as linear as Galaxy, only it doesn't try to hide it. And that's fine, because the game was designed around having multiple players which is a ton of fun. Just like NSMB series, the more people you play with, the more difficult it is, but it makes for a great co-op (or competitive) experience. The level design is also very good. People seem to overlook that in this game, but really it's just awesome. Plus the vast majority of levels offer some sort of unique mechanic or twist that aren't in any other level. It's not just "Ugh, here's another typical Mario level" because it's always doing something exciting to keep players on their toes. People are salty because they didn't Galaxy 3 and instead got something new, so a lot of people haven't given this game a fair chance.
Sunshine is a lot of fun, but I feel like there were a lot of ways they could and should have done better. Some of Mario's jumps and moves were either replaced or just taken out from 64 - no more long jump?? He controls well, but it's much tighter than before. The F.L.U.D.D. allows for getting around levels in different ways, but honestly I think I would have preferred it not be used as a means of getting around the environment because it's slow and tedious. I don't feel like some of the levels were designed all that well - probably because they were keeping the F.L.U.D.D. in mind - and some are just not very fun to play. And then some of the "secret" levels like that pachinko machine and the sand phoenix are just horrible. Overall it's still a great game though.
Galaxy (and Galaxy 2) is incredibly overrated. WHOA HE CAN WALK UPSIDE DOWN LOLOL! Big deal. That doesn't make the game good. There's unique uses of gravity and levels do weird stuff with it and that's neat (most of the time), but (again, most of the time) it's just a gimmick and is pointless to how the game is played. The levels are incredibly linear, despite what everyone insists, it's just that they are designed in such a way that it doesn't feel like it because you are constantly being launched to other planets. Linearity is fine, and really every level needs a clear means of getting from point A to point B. "But 3D World is linear and you loved that!" I hear people say. Yes, because 3D World was designed around being multiplayer with everyone on the same screen at once, so linearity became a necessity. The Galaxy games are single player and encourage exploration due to not having a timer and having the goal of the level or certain sections being vague at times, but they don't give you an interesting area to explore, thus negating the exploration entirely. There's always a sense of constriction, even though often times Mario is in space. Where you need to go is almost always obvious and you rarely have any choice but to go in that direction. Final Fantasy 13 does the same exact thing and everybody hates it so much. Unlike in 64 and Sunshine, the hub world is very small and there's nothing interesting to do there. Those problems aside, the game(s) is still a lot of fun, just highly overrated. Also the music is beautiful.