TT #97 · Parashas Shoftim · Second Aliyah · Passuk 17:16
Only he must not multiply horses for himself, or cause the people to return to Egypt in order to multiply horses, since the Eternal has said to you, ‘You shall not return that way again.’
Torah Temimah points to Sanhedrin 21b.
TT lemma: לֹא יַרְבֶּה לוֹ סוּסִים.
English: ‘Only he shall not multiply horses for himself’ – one might have thought even for his chariot and horsemen; therefore the Torah says ‘and he shall not cause the people to return to Egypt.’
Derash limiting the scope (Bavli) — the prohibition is not absolute against any horses; it targets excess that leads to returning to Egypt.
The king may keep horses needed for his military needs, but he is forbidden to multiply them in a manner that would send Yisrael back to Egypt.