Taking the blame depends on the situation.
My best friend and I are at his girlfriend's parent's house. My friend breaks something valuable or sentimental to the parents. In order for him to not be in hot water with his girlfriend's parents, I take the blame.
Then there are extreme circumstances where you should never take the blame.
My friend kills someone and wants me to take the blame.
Why would I ever take the blame for that? I may keep my mouth shut about it because they're my friend, but I'm not going to take the blame for it.
If you have a good friend who just made a mistake and the punishment is not going to be as harsh on you than him (circumstancial); you should take the blame. It's called being a friend.