I would never suggest doing it just for a room. Obviously using someone else's ID is illegal. Now this is only the viewpoint of a casino worker so understand there is bias and others here could provide you with more valid information regarding actual use from the player's standpoint. If your play has any T31 reporting requirements then providing another persons ID could have some legal ramifications. The last item you might want to think about is Title 31. One other thing to think about is for casinos one of the highest risk areas for fraud and employee theft the last few years has been within the player card/points area and because of that (well at least at my casino) there may be more due diligence at the casino when viewing the ID and confirming the holder of cards identity. Also understand that just because you have a player's card does not mean your play will not be analyzed for AP such as card counting. Be prepared to show ID at some places in order to use any comps/freebies associated with the card. It could also jeopardize your friend's status with the casino.
Some establishments are pretty flexible on player card use but there are certainly many other places that will kick you out and remove any points earned during your play. Not illegal but could very well be against the rules in place at the casino.