It depends on the company involved, but I'm surprised by the number of answers suggesting that this is some underhand way of getting some work done for free. I think that's very unlikely. Unless the company was completely clueless and desperate, why would they get somebody who's ability they are not sure of (which is ostensibly why they are interviewing the person in the first place) to do the work for them? I'm sure that they probably have somebody on their staff already who is capable of doing the work. If you went to interview at Google and they asked you to write some code, would you think it was because they haven't got anyone else that can solve their problem?
Interviewing candidates is hard and making the wrong decision can be expensive. When interviewing a programmer, getting them to write some code is absolutely a good thing to do. You hire programmers to design programs/write code, so why not see how good they are at this?
A four hour task is going a lot further than most companies do, but it's not necessarily a bad idea. I don't think it's that unreasonable either. It's not unusual for companies to ask you to set aside a whole day for the interview process, even if coding doesn't usually account for most of it.
Setting somebody a real programming task, as opposed to something like FizzBuzz, could be extremely valuable for the interviewers. They may be looking for how you deal with ambitious deadlines and unclear requirements, how you approach problems and how you structure and prioritise your work.
One final thought: A difficult interview is a good sign from the candidate's perspective. Remember that your future co-workers will have been judged by the same standards. If there's no quality control you could end up working with some less than gifted individuals.