Much commercial mail (including first class non-junk mail) is physically presorted and bundled as it is dropped with USPS and has a bar code that states the routing needed. Stuff that has had OCR performed by computer or human gets a little sticker near the bottom with the barcode.
The barcode is applied by the sender; the Postal Service required use of the Intelligent Mail barcode to qualify for automation prices beginning January 28, 2013. Use of the barcode provides increased overall efficiency, including improved deliverability, and new services.