system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: If "calories in < calories out = weight loss," how can certain medications cause weight gain or weight loss?

Additional question: What role does insulin resistance play in calorie intake or output?
gpt
Medications that cause weight gain/loss are often screwing with your metabolism. Say your car gets 20mpg and you are going on a 100 mile trip. You put 5 gallons in it and you're good. Now say you add a fuel additive that makes your car get 25mpg, or 15mpg. Now if you add the same 5 gallons for your hundred mile trip you will either have fuel left over or run out.

Some medications also affect appetite. Now you still need 5 gallons for your 100 mile trip, but you only feel like putting in 3, or maybe now you want 7. In your body, less fuel than you need causes weight loss and more than you need causes gain.