I might be wrong, but I think they produce batches of a single config. Let's say thats 100 (for the sake of maths), and 90 are for orders, 8 are may need manual checking/refurb and 2 may go into stock. The 90 customers get their machines shipped out, the manual checks may be fine and go into the stock pool or triage of some kind. If other orders match they may get allocated the stock ones, in the case of a backlog. So 90 people get things as planned, 2+ people may luck out and get bumped up. The non-conforming ones may end up as display models etc.
Those are made up figures, but the principle in production lines hold. Foxconn don't know its your machine, but they will have the numbers to manage batches, and they'll know their percentages of non-conformities etc.