It has nothing to do with the quality. The machines come in flawless condition. Apple cleans the display, makes sure there's no scratches/fingerprints on the casing, replaces the battery, and cleans out the OS completely.
In fact, refurbs generally can be of HIGHER quality than new machines, simply because they've been tested. How many new machines do you think are tested? Probably very few in the assembly line. ALL refurbs are tested.
I'd be willing to place a bet that you could simply replace a refurb machine with a new machine and no buyer would ever be able to tell the difference. The issue is, Apple legally can't do that. Therefore, they offer refurbs at a relatively significant discount.
Rest assure, buying a refurb is essentially EXACTLY the same as buying a new machine. The difference? You don't get the

unboxing experience.