Programming many Atmega328p at once for mass production
To program in-circuit, you can also use either a JTAG-Connector - as seen on the J-Link Mini, or an on-PCB connector - as you can see on this tinyK22 microprocessor that's used at my university quite a lot. You can see the connectors next to the &quot;K20&quot; and &quot;K22&quot; print. The cable to plug this in is fairly expensive, but it allows you to program a board that only has the 'connector' implemented on the PCB.
Rather than downloading through the IDE, you'd download using a standalone flashing program.
If your quantities are high enough, just as the others said, you'd use preprogrammed chips from the factory.