It isn't necessarily "illegal" (in the sense you are committing a crime) but you may be in violation of a verbal contract (which would fall under tort law).
Let's take this a bit further. Perhaps Joe Schmoe gave you his debit card information so that you could make deposits for him and he said you could take $5 out for yourself for the trouble. This is a contract between you and Joe for a service. You can't extend Joe's offer to Jane Doe by saying "here is some debit card information, take $2.50 out for yourself". You have no right to extend your contract with Joe to somebody else.
Now specifically for passwords it basically boils down to the same thing. Unless Joe gives you explicit permission to give that to somebody else, you can't just decide to unilaterally give what Joe gave you to somebody else.
This may be different if Joe said "here, I'm buying you a subscription to service XYZ because you are a nice guy", this may be construed as a gift which transfers ownership. At that point you have control over what is or isn't done with the account.
As another example let's say Joe let you borrow his car. You can't turn around and say to Jane, "here's a car you can use", Joe did not extend the offer to Jane, nor did Joe give you the right to extend the offer to another person.
It's a moot point though, in the original context of this question, Netflix does restrict you from sharing your passwords "outside your household". Almost every paid service has some restriction against sharing with others.
In the end Netflix may shut off Joe's account and Joe may sue you for damages, but you aren't going to be thrown in jail for this. This would be a civil case (tort) which you may be liable for monetary damages.