I'd recommned buying them both when you have the chance. Though I personally prefer Terraria over Minecraft.
I sunk over 40 hours to Terraria on my first 5 days, not so much on Minecraft. Terraria has more variety in terms of areas/gear/monsters and it takes longer time to reach/get/beat them (f.ex Corruption is almost impossible to traverse without better gear/friends, nevermind Underworld). In Minecraft there really is nothing else than your desert, mountains, snowy area, forests and a single underground layer (at the moment that is), and later Nether. Also, the gear you get in Minecraft is pretty random. You could be donning full diamond in matter of minutes if the world generator is generous enough and you're lucky, but in Terraria no matter how you play, it's going to take a long time to get to the endgame areas and get the best gear. Oh, and the boss fights are goddamn awesome.
Err... Like people have already said, buy Terraria for adventuring, Minecraft for building.