sony was still building up there sce while nintendo was as big as ever since ~ 1995. im not sure how this is affecting the operatin income, though
This isn't true at all. Nintendo hugely bulked up their internal R&D teams for N64 (EAD especially) and during the late 1990s/early 2000s they invested in a ton of external developers (Rare, Silicon Knights, Leftfield, etc) and even more start ups (Marigul, NST, Mobile21, NdCube, Brownie Brown, etc). Nintendo was growing right alongside SCE really, and SCE themselves were already pretty sizable as of 1995 (having built up SCEI since the early 1990s on SNES games, building up SCEA teams like SISA/989 and Singletrac in 1993/1994 in prep for PSX and acquiring Psygnosis in 1993).
probably because nintendo doesn't usually sell consoles at a loss and they have a huge advantage by having Mario and Pokemon as flagship IPs where sony has never owned such powerful first party IPs , besides GT, and i am sure developing a GT game is way more expensive than any POkemon or Mario game out there.
Well, Nintendo built their IPs up with careful planning and consistent quality, it's not like Mario and Pokémon just came out of nowhere fully formed and sold like crazy. I think a lot of Nintendo's 1st party success comes from their roots as being a toy and card games maker, and the integrated approach they have to making hardware and software. Ensuring product appeal and innovation is really in their DNA, which is why they have such a wide catalog of successful and influental videogames.
Sony meanwhile still has the mindset of an electronics giant, and their development is almost wholly segmented. I think that comes through in their products as well, not only versus Nintendo but also other previous Japanese hardware makers like Sega, SNK or Hudson. If you look at Sony's lone huge franchise (GT) it's also a brand that's appeal entirely hinges on real world licenses... the problem at Sony is a problem of creativity from the top down, and while they do mitigate that somewhat by acquiring and absorbing hugely creative external devs (like Media Molecule for example) I still think the segmentation leads to a disconnect that impedes those games anyway. It's a structural problem, and not one I'm sure Sony can really change.