A publisher can't say that it's illegal for you to buy something. But it is covered by copyright, and they can refuse to sell it directly to you.
By the First Sale Doctrine, if a person buys something that is copyrighted, they can sell it to you provided they sell you the original and they do not keep a copy. So, if you buy an original copy from someone who legally purchased it, it is fine.