Before dying, Jacob blesses his sons in a burst of prophetic vision, blessing Judah as the father of the Davidic dynasty by saying, “The scepter shall not depart from Yehuda, Nor the ruler’s staff from between his feet; So that tribute shall come to him And the homage of peoples be his” (Genesis 49:10).
In this verse, the Hebrew word for ‘tribute’ is Shiloh (שילה), derived, according to the Midrash, from a contraction of the words shai lo (שַׁי לוֹ), which means ‘a gift for him.’ This is learned from a verse in Psalms (76:12) :
all who are around Him shall bring tribute (shai שַׁי) to the Awesome One.
Shiloh was, in fact, the city in Samaria that hosted the Tabernacle for 369 years as described in the beginning of the Book of Samuel. Ibn Ezra explains that in this part of the blessing, Jacob was referring to the city of Shiloh. The Tabernacle in Shiloh was destroyed shortly before David was chosen as king (Psalms 78:60). This blessing was therefore explained by the Daat Zekeinim to mean: “The kingship will not depart from Yehudah… [but this kingship will not begin] until [the tabernacle in] Shiloh [is destroyed]”.
But many commentators have a different understanding of Jacob’s use of the term Shiloh. Rashi explains that in this context, Shiloh means “the king Messiah”. The Aramaic translation by Onkelos also translates the word Shiloh as Messiah.
This is further explained in The Israel Bible:
The Hebrew word for tribute in this verse is Shilo (שילה). Fourteenth century scholar Rabbi Yaakov ben Asher, known by the name of his Bible commentary as the Baal Haturim, reveals a hidden connection between the word Shilo (שילה) and Mashiach (משיח), the Hebrew word for ‘Messiah.’ According to the mystical study of gematriya, every Hebrew letter corresponds to a different number. With this understanding, if the numerical values of diverse words and ideas match each other, this means they are secretly connected. Amazingly, the numerical value of the words yavo shilo (יבא שילה), ‘Shilo shall come,’ is to 358 which is exactly the same value as the word Mashiach. With prophetic foresight, Yaakov blesses Yehuda not only with the monarchy, but with the eventual emergence of the Messiah through his lineage.
The Zohar (I:25b) notes that the gematriya of the word Shiloh by itself (שילה) is 345, which equals the gematriya of the Hebrew name for Moses, Moshe (משה). Moses is closely associated with the Messiah when he is called “the first redeemer and the last redeemer” in Shemot Rabba 2:4, which explains that “the soul of the Messiah is the soul-of-the-soul of Moses.”
The term Shiloh is even included in Hebrew term for Messiah, משיח. The Talmud (Sanhedrin 98b) discusses the possible names of the Messiah, with different sages suggesting Menachem, Shiloh, Yinon, and Chaninah. Rashi noted that the first letters of these names can be arranged to form the word Messiah.