How long before intended date of use can a ham be purchased?
I don't believe it will make any difference, and here's why - 

You may be buying the ham a few days earlier, and the ham may be part of a shipment that was received and stocked at a certain date, as opposed to a later date, but it's doubtful there is a significant difference in the dates that a ham on sale today, and a ham bought Wednesday next week was processed and packaged. That's a mass-produced product, with a huge bump in production near the holidays.

It's highly doubtful that the store would make a huge (with, assumed on my part, a certain volume discount or seasonal sales price) purchase of hams for the holiday, and then order more hams, not as part of that order, to be stocked before the same event/holiday.

What you will also see, depending on how well they gauged demand, is that hams will be deeply discounted a week or two after the holiday, as the remaining hams from their mass order start getting closer to the product expiration date.

Your best bet for determining how long before a holiday is (if you're not going to freeze it) looking at the "use by" date.  Any pre-holiday ham sale is going to have hams with a "use by" date that goes past that holiday.