Nintendo has always been fond of favoring second party relationships and working tightly with them to create either new IPs themselves, or expand on their existing IPs. HAL Laboratories is famous for Kirby, Super Smash Bros, working closely with Creatures, Inc. and Game Freak on Pokémon titles, and the Mother / Earthbound series, and was so close that their darling programmer and later manager Satoru Iwata became the first president of Nintendo outside of the Yamauchi family. Other strong second party development studios that Nintendo has hitched their horse include but aren't limited to Intelligent Systems (Fire Emblem), Retro Studios (Metroid Prime, though now a first party studio), and Argonaut Software (Star Fox).
Rare was just trying to make games before their eventual partnership with Nintendo grew. I believe I read somewhere though that the relationship started to wane, so when Microsoft started wining and dining studios to build their own second party studio, when they came to Rare, the company saw the dollar signs and promises of more creative agency and decided to hitch to another cart. Since then, the company has released some successful titles since then, but arguably none are as notable as during the heyday of their partnership with Nintendo.