The short answer is half and half. In their own worlds they are rivals by definition — mascots of competing companies, built to sell consoles — but whenever they have actually shared a screen, as in the Mario & Sonic Olympic series, they have been friendly teammates.
So the honest verdict is friendly competition: allies when the situation calls for it, opponents the rest of the time.