This has been my experience with dozens of M4 and M16s. Shitty mags were almost always the culprit... although with junior soldiers sometimes they don't clean and lubricate their weapon as well as they should, and that also leads to problems (but usually shitty magazines).
Lubrication and cleaning are imoortant for sure. Especially for tighter toleranced.
Spesking of cleaning: as i was reading the official manual and instructions for the Mosin rifle, dated 1954, i came across the following passage (quoting loosely): a soldier should spend his free time cleaning his gun.
So regardless of manufacturing tolerances and engineering intent, cleaning is not something to neglect.