Higher costs are hurting profit margins at many Main Street retailers and shoppers who feel more pinched are buying at big-box stores.