Your metabolism level, and the percentage of calories that are actually taken up by fat cells, depend on many factors besides total calorie count.
A nice paper that came out recently: https://www.sciencedaily.com/releases/2015/11/151119143445.h...
So, for example, person A can eat 3000 calories of cookies per day, but would gain weight on 3000 calories of rice. Person B could be the opposite. From the paper, it looks like genetics is a factor, though epigenetic factors and microbiome seem more important.