Declining coauthorship is actually quite common behavior in my field (mathematics). It is so common that not lightly do I question its ethics. In most instances I have seen it appears rather borderline, or the ethical questions that it raises are accounted for in other ways by the profession. However, taken to the extreme I think it would certainly result in unethical behavior. Thus my comment questioning another comment made on Nate Eldredge's answer:
An author always retains the right not to receive credit for his or her work.
I think this statement is clearly too strong. If you systematically pass off your work to others, you are participating in a form of plagiarism and giving (assuming that your work is good, which I will since this is the version of the practice I am familiar with) an unfair advantage to your should-be coauthors in what is now an extremely competitive academic environment.
Stage 1: Let's start at the extreme point: if you do all the work on a paper (or project, or thesis) and then pass it off to someone else who puts their name on the paper, I hope we can all agree that not just they but also you have done something deeply unethical. As I have before, I will point to this excellent short story which describes an especially interesting case of this. The story describes realistically how the discovery that the main character has written the PhD thesis of his ex-girlfriend would get not just her but also him in trouble.
In this extreme case there is another ethical violation occurring: someone's name is being put on something which they did not have intellectual involvement with.
Stage 2: Let's imagine that a more senior author really did the work of the paper and explained it to someone more junior: possibly their own student, but it happens in another cases as well. And let's say the junior person writes up the work in the formal sense but not without a lot of help from the senior person, to the extent to which that without substantial guidance from the senior person the junior person probably would not have been able to write up the work in an acceptable way. The junior person has in some superficial sense "contributed to the work", but I would argue that really he has not. And to focus ideas let's imagine that this in a field like mathematics (or TCS, theoretical physics...) in which the idea of "valuable routine work" is largely or completely absent: e.g. the junior person did not do any interesting or independent calculations, coding and so forth.
I still feel that this is a serious ethical violation. If it results in the junior person getting a PhD thesis, then I feel bad about that. If this is a larger pattern of behavior and results in the junior person getting several publications which advance his career, then I feel terrible about this: I think the senior person is doing something really reprehensible.
Stage 3: Now imagine that the senior person had the idea for the project, had some of it worked out in advance (but not shown to the junior person), had ideas about how the implementation was to take place, but left at least some substantial part of the implementation to the junior person. Let's say the junior person did at least a substantial part of the work independently, and let's say that he did some things in a way different from what the senior person would have thought to do which is not obviously worse.
This stage is an accurate description of the relation between many thesis advisors and their students in mathematics. In mathematics this type of interaction probably most commonly results in a solo paper by the student, and the likelihood that this will occur is positively correlated with the research strength of the advisor and the department. I grew up watching this practice and therefore got used to it. Once I saw how differently other fields operate I started to wonder whether this was really ethical behavior. I think in practice it is not such a serious problem because in mathematics who your advisor is is known to everyone who knows you: when you meet someone new or talk about them with a colleague, "Who was his advisor?" is one of the first questions that gets asked. It is quite common for someone who got their PhD at a top mathematics department to have their first publication in a truly excellent journal on the topic of their thesis -- deep, cutting edge stuff in their advisor's field -- then a short gap, followed by other papers which are minor variants of previous work or are interesting and valuable but in a different, lower-to-the-ground field. When potential employers see this type of CV, we largely tend to think "I get it: the advisor really did much of their thesis work, and without her the candidate cannot continue doing work of the same quality." Unfortunately this might be unfair in the other direction: for instance some advisors really don't give much direct help to their students. That was the case for me, and luckily various people told me that my advisor has a reputation in the community for not doing his students' theses for them, with the result that some of his students have written much better theses than others (mine was somewhere in the middle). So it's not clear how to arrive at a "standard advisor discount". Taken the other way, sometimes you do see an eminent advisor writing a paper jointly with their student on the topic of their thesis work, and all of a sudden it becomes less clear what this means: there needs to be an explanation of this in the letter of recommendation (but the explanation is not always absolutely clear or convincing either: every student everywhere always did "at least half of the work" according to recommendation letters).
Most eminent thesis advisors regard the help that they give their student to write an excellent thesis as a one time gift, at which point they leave their former student largely alone to sink or swim. However in a small number of cases there are eminent advisors who just have that many good ideas and that generous a nature. Maybe they feel that the way to function as a leader in their field is to feed their former students the ideas they need to do first-rate work. I cannot imagine trying to tell these eminent people not to do this, but nevertheless the practice seems unfair in a competitive job market. It contributes to feelings that the top departments form a kind of elite club that, if admission is not granted by the age of 24 or so, will be almost impossible to join later in life. This is not good for the profession.
There are further stages. To be clear, starting with Stage 4 I would myself be a participant in the process (and sometimes I think I would be a better advisor if I were more onboard with Stage 3). If you're a senior person and you feel like you made what was really only an offhand remark to someone, then even if that offhand remark was crucial in the writing of their paper you are relatively unlikely to want to be a coauthor. I respect that very well and I have to: that kind of expertise and generosity is part of being a senior academic (in my field at least; I assume it's not so different elsewhere). At my relatively middling career stage I have already made plenty of remarks to others that have resulted in acknowledgments in their paper, and I have already turned down at least one offer of coauthorship. And there was one relatively recent case where I offered coauthorship to a very senior person: he declined, roughly because he had almost forgotten the remarks he had made to me about five years (!!) before. I hadn't, and they were crucial to writing what for me is a very good paper. So there is a continuum here and many judgment calls to make; I want to be clear about that. But I also think that we should draw the line somewhere before "An author always retains the right not to receive credit for his or her work."