Don't know about the strict legality of the "test ride", but I know I've gotten different responses from different dealers.
First dealer I visited after MSF claimed that I couldn't test ride without specific motorcycle insurance (a claim later refuted by my agent). They wanted you to temporarily purchase the bike, take up to 50 miles/50 minutes to evaluate it, and then return and make a final decision (buy or tear up check). Sounded kind of risky to me.
My friend and I then visited a Victory dealer. Their response (to my friend's request ... too big a step for me) was "saddle up"!
Before buying my bike, I went to two Yamaha dealers and test drove a used SV650 and an '06 FZ6 with no problem (just show driver's license and proof of auto insurance).
Bottom line is that it's their bike, and they don't have to let you drive it. But it's also your money, and you don't have to buy their bike.