Interesting. There is a site I shop at a few times a year. They always post the discount codes on the homepage so anyone can use them. It's things like save $X when you spend at least $Y. I wondered why not just automatically discount the sale. Maybe it's something to do with the positive effects of feeling like you got a deal.
Getting the person to do something in order to get the discount would be an action that has a positive effect and is not passive (and perhaps not even realized). Off the top I can't think of what the concept is called but I've seen other examples of this. (Like when you have to check off checkboxes on a paper form etc.)
Another thing is there are going to be people that aren't going to put the code in and you would make extra money off of them when they forget to use it. I don't know the percentage of that but it's certainly greater than 0, right?