Unknowingly driving school bike purchased

Hello all, I bought a BMW G 310 R from the dealer about a week ago, first registration Dec. 2020, 12k kilometers for 3800€. Now I just registered the vehicle online and then Googleled the previous owner: Apparently a driving school operator, who on his website also indicates to use a G310 R for the A2 bill. (however Bj 2021) However, the motorcycle was not allowed on the driving school, but on it private. Now my two questions: Such a driving school mash ne is probably in a much worse condition, isn’t it? What rights do I have against the dealer, because I was denied the origin?