Here's the FAQ from the TTB (the section of the Federal Government that deals with alcohol). With beer, they tax you on what is produced, not what is sold and I'm sure it goes the same for distilled spirits. Which would mean that even if they aren't selling it, they still need to pay taxes on it otherwise it would be illegal. I'm sure they need some sort of permit as well just to produce in the quantities that they do.
Moonshine isn't illegal.
In many states it's illegal to [i]sell [/i]your own alcohol, because it didn't get approval from the FDA. Making it and consuming it yourself is fine, though.