In Isaiah 8 the living are forbidden from contacting the the dead. The Bible says "the dead know not anything". In 1Thess 4 the dead are spoken of this way...
1Thess 4
1Thess 4
13 But we do not want you to be uninformed, brethren, about those who are asleep, so that you will not grieve as do the rest who have no hope.
14 For if we believe that Jesus died and rose again, even so God will bring with Him those who have fallen asleep in Jesus.
15 For this we say to you by the word of the Lord, that we who are alive and remain until the coming of the Lord, will not precede those who have fallen asleep.
16 For the Lord Himself will descend from heaven with a shout, with the voice of the archangel and with the trumpet of God, and the dead in Christ will rise first.
17 Then we who are alive and remain will be caught up together with them in the clouds to meet the Lord in the air, and so we shall always be with the Lord.
18 Therefore comfort one another with these words.
God's Law made it a crime punishable by death to deal with the dead spirits in any way.
In 1Cor 8 Paul points out that when the pagan pray to gods "represented" by wood and stone - they are in fact engaged in the "worship of demons".
Demons are given more freedom to deceive in areas where humans are deliberately going into areas God has forbidden. But they SELDOM present themselve as "hey this is a demon speaking I would like to argue a point with you to see if you can be convinced to follow me".
In fact as we see in Gen 3 -- they often appear in a form that is more acceptable by the victim and they often appear to want to "help".
in Gal 1 Paul says "though we or an angel from heaven should come to you with a gospel message that is OTHER than the one we have preached - let them be accursed".
The "purpose" of demons in the case of the OP is to convince the target victim that the dead loved ones are in a position to hear prayers - contact the living - involve and interact with the living.
in Christ,
Bob