Codes are offered via e-mail or postcard. They typically offer a discount on a room.
Free Dining does not require a code, and is offered to anyone (as a PP said, it's open first to Disney Visa card holders, but then the general public). I have always seen the Free Dining promotion advertised here on the DIS boards, through
Dreams Unlimited (link found at the top of the DIS), and on the Disney web site itself. You just have to check in around early April to see if it's being offered again!
Someone else mentioned dates - the window for Free Dining has shrunk over the last few years. I think the first year it was offered, it was mid-August right through the end of September. This year it's shorter by 2 or 3 weeks.
.