Does buying from the spider bake sale end a Genocide run?
No. Assuming you're still on the Genocide route, purchasing an item from the bake sale will not shift you off of it. From the wiki:
Purchasing an item from the Hotland bake sale does not abort the Genocide Route. Muffet will mention that the protagonist donated, but she will still be suspicious of them and attack. If she is spared, the Genocide Route will be aborted.
As long as you don't Spare Muffet, you'll still be on track to finish your Genocide run.
This is also backed up in the Genocide route wiki page:
Muffet does not show up for her bake sale. It is still possible to buy from the bake sale, but this does not prevent the fight with Muffet. Before she is fought, she does not consider the protagonist to be fit to eat but attempts to dispose of them regardless.