Of course they can ask, and you are NOT required to give it. They want it to use for marketing purposes. If you say no, will they refuse to sell to you for cash? Not likely.
I am not your lawyer and you are not my client. Free advice here is without recourse and any reliance thereupon is at your sole risk. This is done without compensation as a free public service. I am licensed in IL, MO, TX and I am a Reg. Pat. Atty. so advice in any other jurisdiction is strictly general advice and should be confirmed with an attorney licensed in that jurisdiction.
Mr. Burdick is correct: it is for marketing purposes, not legal purposes.
Years ago they required your drivers licence, phone number etc. if paying by check, but new laws now forbid it.
The above is general legal and business analysis. It is not "legal advice" but analysis, and different lawyers may analyse this matter differently, especially if there are additional facts not reflected in the question. I am not your attorney until retained by a written retainer agreement signed by both of us. I am only licensed in California. See also avvo.com terms and conditions item 9, incorporated as if it was reprinted here.