Part of what you say is true, but part of it is paying for all the acceptance testing, meeting the .mil spec EXACTLY, all the paper work etc. And the salaries of all the people who do that work.
Stuff like the cheap Chinese BSA red-dot scope on top is LOL-worthy, but it's not quite as simple as buying an assembly, having the engineer design the housing and mating it to an M-16/M4 grip, and having the machinist turn it out, and then an electronics tech assemble it all.
I work in Aerospace/Defense Quality Assurance tracking, and dealing with the .gov and .mil is incredibly involved even when it runs "smoothly".
People will roll out the old tropes of the $400 hammer. Well really that $400 hammer was a beryllium/copper alloy designed to not spark EVER when being used to wail on a stuck pipes, valves, or hatches, when rocket fuel was leaking in an emergency. And the famous $100 toilet seat was for a submarine, that had to be designed to be absolutely quiet, if a sailor were to drop it, so it wouldn't clack on the bowl and give away their position to Soviet Sonar.
So it's possible these laser dazzlers were rip-offs, but even if they were, they weren't as much of one as you might think.