Quoting Commentary for II Samuel 23:21

וְהוּא־הִכָּה֩ אֶת־אִ֨ישׁ מִצְרִ֜י אשר [אִ֣ישׁ] מַרְאֶ֗ה וּבְיַ֤ד הַמִּצְרִי֙ חֲנִ֔ית וַיֵּ֥רֶד אֵלָ֖יו בַּשָּׁ֑בֶט וַיִּגְזֹ֤ל אֶֽת־הַחֲנִית֙ מִיַּ֣ד הַמִּצְרִ֔י וַיַּהַרְגֵ֖הוּ בַּחֲנִיתֽוֹ׃

and he slew an Egyptian, a goodly man; and the Egyptian had a spear in his hand; but he went down to him with a staff, and plucked the spear out of the Egyptian’s hand, and slew him with his own spear.

Haamek Davar

You shall not withhold the wages. If a person permissibly gained possession of someone else’s property, such as by a loan or the like, but he does not intend to return it is called עושק (oppression) and not גזל (stealing). Stealing is only is the case of, “And he grabbed (ויגזול) the spear from the hand of the Egyptian” (Shmuel II 23:21), which is that he forcibly grabbed it in the first place.
Ask a RabbiBookmarkShareCopy

Rashbam

לא תגזול, similar to Samuel II 23,21 ויגזול את החנית מידו, “he wrenched the spear out of his hand.”
Ask a RabbiBookmarkShareCopy

Ibn Ezra

robbed by force (as in, “he snatched the spear” [II Samuel 23:21])
Ask a RabbiBookmarkShareCopy