Yes, the basic tennet of all retail is "the management reserve the right to refuse service" essentially they don't have to serve you if they don't want to so they can impose any conditions they like. It's unusual but perfectly legal.
It is legal yes. Why they'd want to do that though is beyond me as it costs them more to accept credit cards and are more likely to be subject to fraud and chargebacks.