Obviously any Mario Kart (or basically any Mario game really) is going to sell like crazy. As far as the rating comparison, Mario Kart appeals to a wider audience, being E rated and involving Mario, but at the same time there are a multitude of people who are going to buy GTAIV because it's "cool" and not buy Mario Kart because it's "kiddie" so in that respect the E rating (and M rating) can both help and hurt sales, depending on the audience. Overall I think the E is a plus for sales though, as it pretty much always is AFAIK, since parents will buy them pretty much by default as well as people who have grown past the stage where they buy things according to coolness.
But just any E rated game isn't going to necessarily share that success, the name recognition and the fact that it's awesome helps it too. GTA is a huge seller with name recognition as well, so I would say that Mario Kart beat it out mostly because of the larger base for the Wii, not so much because of the rating or anything else.
They're both very good games, I also bought both of them. It would probably be more interesting to compare percentages relative to the console base to see their actual popularity amongst those groups, but GTAIV being on multiple platforms and the Wii basically selling just because it exists more so than because it plays games would probably complicate that.