Yes - they have, but only on a limited basis. Usually only when a customer has ordered the *day* before the release, online, and Apple hasn't had time to build the CTO machine. In terms of economic sense - the handful of customers that they swap machines for likely won't make any discernable difference to Apple's figures.
Apple has done this in the past, but it's been rare and circumstantial. If you are planning on throwing a fit because the computer you bought is not the newest machine on Apple's lineup, shame on you. Noone hamstringed you into buying the machine. It does every single thing it was advertised for. Your machine does not become defunct once a new machine is released. If you are going to be unhappy with your purchase, don't buy a new machine! It's your call, not Apple's to make a purchase. Everyone seems to almost expect Apple to swap their machine with a new one if a newer model is released. Grow up.