This is one of the more irritating claims I hear repeated. It's not specific to the US either.
The answer is no, merchants have no obligation to accept money for a purchase.
The simple reason is that US currency is only legal tender for debts. It is illegal to refuse legal tender for a debt. When you make a purchase at a store, there is no debt.
Rather, you and the merchant are agreeing to enter into a (very brief) contract. If the merchant doesn't agree to the terms of that contract, i.e. the currency denominations someone wants to pay with, he has no obligation to enter into that contract.
This is based on Federal law which states that legal tender must be accepted for all debts. There is no law stating that legal tender must be accepted for other purposes.
The U.S. Treasury states quite clearly:
There is, however, no Federal statute mandating that a private
business, a person or an organization must accept currency or coins as
for payment for goods and/or services. Private businesses are free to
develop their own policies on whether or not to accept cash unless
there is a State law which says otherwise. For example, a bus line may
prohibit payment of fares in pennies or dollar bills. In addition,
movie theaters, convenience stores and gas stations may refuse to
accept large denomination currency (usually notes above $20) as a
matter of policy.
Coinage Act of 1965, Section 31 U.S.C. 5103
United States coins and currency (including Federal reserve notes and
circulating notes of Federal reserve banks and national banks) are
legal tender for all debts, public charges, taxes, and dues. Foreign
gold or silver coins are not legal tender for debts.