Losing Fat/ Gaining Muscle Question

I had a question which I’m not sure has an answer
How much muscle can be gained on a fat loss diet?
I see people on fat loss diets all the time and they end up losing fat but gaining like 4 lbs of muscle as well. I know you need to have a calorie surplus to gain muscle so how does that work?
Please bear with me as I’m new at bodybuilding.
Thanks

Just do a clean bulk instead of cutting imo…

[quote]Alex-P wrote:
Just do a clean bulk instead of cutting imo…[/quote]

As stated above, just eat lots of clean food…ie: chicken, fish, real whole wheat, veggies, fruit…ect