The two texts:
“When you come to the land which the Lord your God is giving you, and possess it and dwell in it, and say, ‘I will set a king over me like all the nations that are around me,’ you shall surely set a king over you whom the Lord your God chooses;
one from among your brethren you shall set as king over you; you may not set a foreigner over you, who is not your brother.
But he shall not multiply horses for himself, nor cause the people to return to Egypt to multiply horses, for the Lord has said to you, ‘You shall not return that way again.’
Neither shall he multiply wives for himself, lest his heart turn away; nor shall he greatly multiply silver and gold for himself.
“Also it shall be, when he sits on the throne of his kingdom, that he shall write for himself a copy of this law in a book, from the one before the priests, the Levites.
And it shall be with him, and he shall read it all the days of his life, that he may learn to fear the Lord his God and be careful to observe all the words of this law and these statutes, that his heart may not be lifted above his brethren, that he may not turn aside from the commandment to the right hand or to the left, and that he may prolong his days in his kingdom, he and his children in the midst of Israel.” Deuteronomy 17:14-20
Compared with:
I gave you your master’s house, and put your master’s wives into your arms. I also gave you the house of Israel and Judah. And if all that somehow seems insignificant, I would have given you so much more as well! 2 Samuel 12:8
There are similar questions on this site pertaining to this general question:
Did God permit David to marry numerous wives in 2 Samuel 12:8?
Why does God not just permit but seemingly encourage David's polygamy in 2 Samuel 12:8?
I am not asking if/why God is permitting or encouraging polygamy, but I want to ask if this is a contradiction whereby God gives a law (Deuteronomy 17) and then says He will give something (namely: wives) to David if he had done better, which would violate God’s law. This sounds contradictory from God’s vantage point.
Q: How do we reconcile the kings law Deuteronomy 17:14-20 with 2 Samuel 12:8?