I assume the main point of asking for charities at the POS system is to, in no order, a) give to that charity, and/or b) to get the tax deduction as if the company gave that charity. Ex: $1 charity = some $0.35 discount on company taxes.
And "awareness" is a big part of some cultures [0] as it allows for the distribution of the idea of caring without devoting some of one's life to the cause.
I don't think you get a tax deduction by processing someone else's donations. Even if you did, wouldn't you have to first treat it as income, so it cancels out?
Income $1 and then give away that $1 is a net negative, so I assume it's more like: I give you, the company, $1 as a "gift", which I'm allowed to gift you some hundreds of dollars per year without an extra tax form. You take that "gift" and donate it, thereby netting you the 35 cents.
I am pretty sure it is illegal. It is the donor that may claim the tax deduction, if any. The retailer may not claim it merely by being a conduit for donated funds.