Put simply, as jam3972 stated the Wii Shop Channel only tracks your purchases by the console's unique Serial number or some other possible ID linked to just your Wii. And this purchase list is only tracked/modified through Nintendo's servers so it only tracks legit purchases.
NOW. Nintendo COULD in some fashion track pirated channels through some sort of ticket inventory function, but I do not think there is any functionality for such currently. In addition, if the current wad installers modify the ticket id's in any way, that would also not count as a 'pirated' channel to Wii's servers. Though they could just as easily claim since the ticket id DIDN'T come from their server, it obviously must be pirated. But that is mostly speculation on the end there.
When you format the Wii, AFAIK, it comes as it came from the factory. Same version from the factory, no saves, no channels, no hidden installed wads, patches, etc.. Fresh Wii. Go to the shop channel and you can re-download all your original LEGIT purchased channels without repaying for them since it still sees the same Wii console.