I have had problems from Lyme at both ends of the weight spectrum.
The elements of my experience might not apply to you, but just in case....
Before I knew that Lyme was causing my illness symptoms, I took an SSRI to combat migraines. It didn't work, and it made me gain 25 pounds in four months that would not budge, even years after discontinuing the meds. SSRIs and other drugs (antibiotics, obviously) alter the intestinal flora and can alter neurotransmitters and metabolism as well. After my Lyme worsened and I finally was diagnosed, I had gastroparesis and struggled to eat even 400 calories per day for a year, but still I lost no weight. (This led to a lot of obnoxious conversations with doctors who did not believe that I was ill.) Once I was diagnosed with Lyme and co-infections, my functional medicine doctor insisted on a stool test despite my having no GI symptoms aside from lack of appetite. The stool test showed very high levels of several pathogenic bacteria and almost zero beneficial bacteria. I was not on pharmaceutical antibiotics at any point, so for me it was just Lyme and the SSRI that messed things up so badly. I took a combination of herbs for gut dysbiosis - artemisinin, berberine, black walnut, olive leaf, wormwood - and dropped 25 pounds in one month. I took probiotics as well, all along, but killing the "bad" stuff was necessary for me before adding the "good" stuff would be effective.
Because of this, when I hear of people who are gaining weight without an obvious reason in a way that feels unhealthy to them, I like to encourage people to evaluate their actual gut flora and gut health, not just by symptoms but with testing. It has a huge effects on how much weight we carry.
Hope you find some advice that's helpful!