As a single/multiplayer player game Mario wins with its superior level design and controls, as it happened with their respective current-gen versions.
As a coop game Rayman Legends is much more interactive than 'place a platform' Mario, the reason why it's a contender to buy.
Both games are maybe buys for me, but in the end I'll succumb to Mario and skip Rayman.