top comment here says ergot is the reason, posts under claim the title. I've heard this addressed here to a small extent but never fully explained.
Its fairly safe to consider bullshit since its from TIL (and about history) but I think there might be a cool answer from someone here about the topic explaining the extent of ergot poisoning as a theory for weird things or the extent to which it might be a respected theory. Salem is listed in the comments as well.
Something I vaguely recall in an r/askhistorians post is that there would be certain things present if it was ergot and those were absent.