Is it fitting for Jesus, who died so ignominiously, to be buried in splendor? Thomas has various answers to that question (ST III, 51, 2), but I think the best answers are inherent to the literary structure and themes of the gospel, especially John.
Matthew tells us that Joseph of Arimathea wrapped Jesus in a linen cloth and put him in the tomb (27:59). There’s no mention of spices. Mark records the same as Matthew (15:46), but adds that the women came to the tomb the after the Sabbath with spices to anoint Jesus (16:1). Luke says essentially the same (23:50-24:1).
Only John elaborates: Joseph takes the body, Nicodemus brings “a mixture of myrrh and aloes, about a hundred pounds (!).” They wrap the body in linen “with the spices, as is the burial custom of the Jews” (19:38-42). (Consistent with this, John emphasizes that Mary anoints Jesus “for My burial” with “very costly perfume,” 12:1-8.)
Given the momentum of John’s gospel, this makes perfect sense. Jesus’ death on the cross is an elevation and exaltation, a “lifting up.” The next stage of his coronation would involve investiture and anointing. By preparing Jesus’ body with spices and myrrh, Joseph and Nicodemus confess that Jesus is King of the Jews. More, that He is King of the dead, ready to come back in three days to be King of the Living.