Stories like this are sometimes more complicated than they appear. The infamous examples of $500 hammers, for example, were anti sparking hammers for working around flammables or munitions, hence requiring special materials, certification, and low production runs.
For this case, we have liquid hand soap dispensed by a pump. Pumps require a sealed vessel. Unlike commercial planes, military planes are required to anticipate prolonged operation with an unpressurized cabin. At max altitude of a C17, atmospheric pressure is only 20% of sea level. Off the shelf dispensers are unlikely to be designed to withstand that pressure difference, let alone function normally. In a high demand environment like aerospace, even apparently minor failures like an exploding soap container needs to be taken seriously due to the possibility of unexpected cascading failures. Why not use bar soap, then? Unfortunately this too has complications, like not being able to be securely mounted, liquid soaps having superior hygiene and cross contamination characteristics, and necessity for military standardized soap, sometimes designed for heavy metal, eg lead, which is likely if the cargo were munitions.
This unusual set of requirements unlikely to be seen outside the military context, so whether designed by Boeing or off the shelf the unit would likely have low quantity manufacturing runs, significantly increasing per unit costs. Combine that with the necessary certifications and the per unit costs balloon even further.
While a soap dispenser having an 80x markup seems absurd, it might be more reasonable than it seems at first glance. To be clear, there absolutely is military contractor graft. I just don't expect even a $10,000 soap dispenser would be a substantial proportion if it even within the C17.