it's not illegal, it's just not safe and looked down apon on GTP, there has been stories of people giving their PSN e-mail and password, and when they logged back on after letting someone D/L their account, the borrower changed the OP password and couldn't log back on his original account. and then they are screwed.
there is a clause with beta codes that state, you can share your account with 5 people, but the OP is responsable for their actions on the beta, where the OP could be banned for the actions of the people that D/L his beta code.