In the video game business, you do not make money from the hardware. You make money from the software. The Wii U is far more profitable (or should I say, lost less money) than the Vita. Not only the Wii U had very strong software sales for its install base, but the big hitters were all from Nintendo. So they made all of the money, not just a cut of it (which Sony gets from its third parties).
Edit: And I almost forgot about amiibos too!