My mother in law moved in with us about a year ago and although most of the time she's fine - anytime we have any guests over she starts to say things like she's a whore, he's a child molester - really mean and hurtful things and as you can imagine I don't invite anyone over as a result. She also seems to know what she's doing - because she has an evil smile on her face like she enjoys saying things to cause people pain, embarrass my wife and I.
Can you prepare a close friend with a good sense of humor, and invite them over and have a conversation with her about why she says these things? "Mother, how do you know that? Was it in the paper? You know that's not true. Are you saying that because you want them to go home?" As long as you are totally embarrassed, she has the power. If you can learn to laugh it off, she might stop. "You'll have to excuse mother, she's always reading those tabloids and believes every word!"
Does it happen when someone stays "too long?" If she has dementia, she may be able to keep up a good show for a while, but then she gets tired. Try shorter visits, or try suggesting that she go to her room or watch TV or something relaxing for her.
Try real hard not to be embarrassed, because it is the disease. Your friends must know she's losing it, and if it were happening to someone else, you could laugh at the story. Try real hard to have compassion for her while you try to stop this behavior, because her poor crazy brain has some good reason for doing this. She's not trying to be evil. It's the disease.
Sounds like you may want to consider an assisted living place, perhaps?
Tell her that her remarks are totally rude and inappropriate and that if she continues to say such horrible comments, you will place her elsewhere.