It sound like 2 separate stories,The command on sacrifice a cow and the story about The dead man so what is the connection between them?
The tafsir of Ibn Kathir explain:
"There was a man from among the Children of Israel who was impotent. He had substantial wealth, and only a nephew who would inherit from him. So his nephew killed him and moved his body at night, placing it at the doorstep of a certain man. The next morning, the nephew cried out for revenge, and the people took up their weapons and almost fought each other. The wise men among them said, `Why would you kill each other, while the Messenger of Allah is still among you' So they went to Musa and mentioned the matter to him and Musa said,("Verily, Allah commands you that you slaughter a cow.'' They said, "Do you make fun of us'' He said, "I take Allah's refuge from being among Al-Jahilin (the ignorant or the foolish)).'' "Had they not disputed, it would have been sufficient for them to slaughter any cow. However, they disputed, and the matter was made more difficult for them, until they ended up looking for the specific cow that they were later ordered to slaughter. They found the designated cow with a man, only who owned that cow. He said, `By Allah! I will only sell it for its skin's fill of gold.' So they paid the cow's fill of its skin in gold, slaughtered it and touched the dead man with a part of it. He stood up, and they asked him, `Who killed you' He said, `That man,' and pointed to his nephew. He died again, and his nephew was not allowed to inherit him. Thereafter, whoever committed murder for the purpose of gaining inheritance was not allowed to inherit.'' (http://www.tafsir.com/default.asp?sid=2&tid=2258)
So the whole story of the cow was to revel who was the murder...
This story is another example of Muhammad mixing Biblical stories!
How to become purified from the impurity of the death?
And the LORD spoke unto Moses and unto Aaron, saying: This is the statute of the law which the LORD hath commanded, saying: Speak unto the children of Israel, that they bring thee a red heifer, faultless, wherein is no blemish, and upon which never came yoke. And ye shall give her unto Eleazar the priest, and she shall be brought forth without the camp, and she shall be slain before his face. And Eleazar the priest shall take of her blood with his finger, and sprinkle of her blood toward the front of the tent of meeting seven times. And the heifer shall be burnt in his sight; her skin, and her flesh, and her blood, with her dung, shall be burnt. And the priest shall take cedar-wood, and hyssop, and scarlet, and cast it into the midst of the burning of the heifer.
And for the unclean they shall take of the ashes of the burning of the purification from sin, and running water shall be put thereto in a vessel
And the clean person shall sprinkle upon the unclean on the third day, and on the seventh day; and on the seventh day he shall purify him; and he shall wash his clothes, and bathe himself in water, and shall be clean at even.
So in order to become purified ,It need to sacrifice a red cow with unique criterion's .
It's a command from Moses,there's no dispute between Moses to Israel about it!!!
What is the procedure when finding a Murdered body?
If one be found slain in the land which the LORD thy God giveth thee to possess it, lying in the field, and it be not known who hath smitten him; then thy elders and thy judges shall come forth, and they shall measure unto the cities which are round about him that is slain.And it shall be, that the city which is nearest unto the slain man, even the elders of that city shall take a heifer of the herd, which hath not been wrought with, and which hath not drawn in the yoke. And the elders of that city shall bring down the heifer unto a rough valley, which may neither be plowed nor sown, and shall break the heifer's neck there in the valley. And the priests the sons of Levi shall come near--for them the LORD thy God hath chosen to minister unto Him, and to bless in the name of the LORD; and according to their word shall every controversy and every stroke be. And all the elders of that city, who are nearest unto the slain man, shall wash their hands over the heifer whose neck was broken in the valley. And they shall speak and say: 'Our hands have not shed this blood, neither have our eyes seen it.Forgive, O LORD, Thy people Israel, whom Thou hast redeemed, and suffer not innocent blood to remain in the midst of Thy people Israel.' And the blood shall be forgiven them. So shalt thou put away the innocent blood from the midst of thee, when thou shalt do that which is right in the eyes of the LORD. (Deuteronomy 21:1-9)
When finding a dead body in field and no one knows who killed him,there's a procedure in order to clean the sin of the murder which involve a cow- not red nor yellow.
Again it's a command from Moses,there's no dispute between Moses to Israel about it!!!
As we can see Muhammad took elements from both 2 stories and mixed them into one story!