The Bible gives no explanation of the importance of spices etc. There is no instruction in the Law of Moses or elsewhere. The Bible just says that the linen clothes and spices conformed to Jewish custom.
John 19:40 Then took they the body of Jesus, and wound it in linen clothes with the spices, as the manner of the Jews is to bury.
We might reasonably suppose that the primary purpose of a large quantity of spice was to mollify the stench of corruption.
John 11:39 Jesus said, Take ye away the stone. Martha, the sister of him that was dead, saith unto him, Lord, by this time he stinketh: for he hath been dead four days.
From www.jewishencyclopedia.com
Spices and Plants at the Burial.
Embalming, practised in Egypt (Gen. 1. 2, 26) and in the case of Aristobulus in Rome (Josephus, "Ant." xiv. 7, § 4), was unknown, or at least exceedingly rare, in Judea. But—undoubtedly with the view of removing the odor—spices were put on the coffin or otherwise used at funerals (Ber. viii. 6; John xii. 7, xix. 39), and myrtles and aloes (in liquid state) were carried in the procession (Beẓah 6a; John xix. 39). In honor of dead kings "sweet odors and diverse kinds of spices" were burned (Jer. xxxiv. 5; II Chron. xvi. 14, xxi. 19), together with the bier and the armor (see 'Ab. Zarah 11a), or carried along in the procession (Josephus, "Ant." xv. 3, § 4; xvii. 83; idem, "B. J." i. 33, § 9). Onkelos (Aquila), the proselyte, burned 80 manehs of balsam in honor of R. Gamaliel the Elder (Sem. viii.; 'Ab. Zarah 11a). Later practise added an infusion of the spices to the water with which the dead was washed...
Below is an extract from Sketches of Jewish social life by Alfred Edersheim.
Chapter 10—In Death and After Death
Burial followed generally as soon as possible after death, {#Mt 9:23 Ac 5:6,10,8:2} no doubt partly on sanitary grounds. For special reasons, however, {#Ac 9:37,39} or in the case of parents, there might be a delay even of days. The preparations for the burial of our Lord, mentioned in the gospels—the ointment against His burial, {#Mt 26:12} the spices and ointments, {#Lu 23:56} the mixture of myrrh and aloes—find their literal confirmation in what the Rabbis tell us of the customs of the period (Ber. 53 a). At one time the wasteful expenditure connected with funerals was so great as to involve in serious difficulties the poor, who would not be outdone by their neighbours. The folly extended not only to the funeral rites, the burning of spices at the grave, and the depositing of money and valuables in the tomb, but even to luxury in the wrappings of the dead body. At last a much-needed reform was introduced by Rabbi Gamaliel, who left directions that he was to be buried in simple linen garments. In recognition of this a cup is to this day emptied to his memory at funeral meals. His grandson limited even the number of graveclothes to one dress. The burial-dress is made of the most inexpensive linen, and bears the name of (Tachrichin) "wrappings," or else the "travelling-dress." At present it is always white, but formerly any other colour might be chosen, of which we have some curious instances. Thus one Rabbi would not be buried in white, lest he might seem like one glad, nor yet in black, so as not to appear to sorrow, but in red; while another ordered a white dress, to show that he was not ashamed of his works; and yet a third directed that he should have his shoes and stockings, and a stick, to be ready for the resurrection! As we know from the gospel, the body was wrapped in "linen clothes," and the face bound about with a napkin. {#Joh 11:44,20:5,7}
The body having been properly prepared, the funeral rites proceeded, as described in the gospels. From the account of the funeral procession at Nain, which the Lord of life arrested, {#Lu 7:11-15} many interesting details may be learned. First, burying-places were always outside cities. {#Mt 8:28,27:7,52,53 Joh 11:30,31} Neither watercourses nor public roads were allowed to pass through them, nor sheep to graze there. We read of public and private burying-places—the latter chiefly in gardens and caves. It was the practice to visit the graves {#Joh 11:31} partly to mourn and partly to pray. It was unlawful to eat or drink, to read, or even to walk irreverently among them. Cremation was denounced as a purely heathen practice, contrary to the whole spirit of Old Testament teaching...
I hope you have found this helpful.
May God bless you,
Glenn