“When you have come into the land that Yahweh your God is giving you, and have taken possession of it and settled in it, and you say, ‘I will set a king over me, like all the nations that are round about me.’ You may indeed set over you a king whom Yahweh your God will choose. One of your own community you may set as king over you. You are not permitted to put a foreigner over you, who is not of your own community.”
You can have a king like all the other countries. However, Yahweh must choose him. Obviously, he cannot be from outside the Israelite community or some foreigner. This is the source of the diving right of kings, since Yahweh appoints him.
“Even so, he must not acquire many horses for himself, or return the people to Egypt in order to acquire more horses, since Yahweh has said to you, ‘You shall never return that way again.’ He must not acquire many wives for himself, or else his heart will turn away. Also silver and gold he must not acquire in great quantity for himself. When he has taken the throne of his kingdom, he shall have a copy of this law written for him in the presence of the Levitical priests. It shall remain with him. He shall read it all the days of his life. Thus he may learn to fear Yahweh his God. He should diligently observe all the words of this law and these statutes. He should neither exalt himself above other members of the community nor turn aside from the commandment, either to the right or to the left. Thus he and his descendants may reign long over his kingdom in Israel.”
This is clearly a theocracy, where God’s law prevails. The new king had to read the law all the days of his life. He could not go to the right or the left of the law. He could not have excessive horses, wives, or silver or gold. However, he was not to be a poor man, though. He should not bring the Israelites back to Egypt. If all goes well, he and his descendants will have a long reign by not exalting himself above his fellow Israelites.