‘ If this is your mother's close friend
Then presumably she loves your mother very much
And is hurting too right now
I would invite her to the GP with you
Have the GP tell them about your mum's chosen medical plan
The more you shut her out from you family
The guiltier you look in her eyes
It would be nice for you both to come together now
For your Mum's sake
IMO’
I think this suggestion is a very good one, it mixes common sense & compassion. However, I have seen that OP has said that this is not feasible, so my thoughts turn to the pastoral care team - e.g. the councillors, the faith leaders & the medical team - to see if they can find a space where they can directly address your DMIL’s friends concerns, assure her that she is not suffering & that her wishes are followed. They may even help her to find a way to say goodbye to her dear friend.
This is a difficult time for you all, you are each facing your own mortality & that of some one you each love. Ask for help from the hospice, acceptance of death, mortality & loss is an integral part of what they do & they may be better placed in the short time available to help.
The funeral. I suggest that you go against your immediate prefernces. Do not think to bar or exclude her, none of you will feel better for doing that. Make sure that she is invited because she is your DMIL’s friend & would she want her own friend kept away.
@HeyDuddy, I don’t know where you are located but here funerals are a public event. Anyone can attend & for good reasons. So really you cannot stop her turning up so it’d be wise to invite her promptly.
I’d go further & embrace that her ‘annoyance’ is her open grief at loosing her friend & that she is ahead of you in this. I suggest that you invite her to read a poem or something brief about her friend at the funeral. This gesture of friendship at DMIL’s funeral will go a long way to ease her grief & being blunt, reduce the risk of her holding onto difficult feelings towards you.
No matter how much you & your DH hurt, bear in mind how DMIL would like her friends to be treated, & in turn when the time comes for you &/or DH how would you feel about your friends in the same situation.
But it has to be said, if she does cause a disturbance at the funeral, the staff will manage the situation with firm tact.