I have main and dev branches. I make changes in both and check in. I merge from main to dev and check in. Now I merge from dev to main. I have conflicts. How is this possible?
Resolving a conflict for a merge in one direction is not necessarily appropriate for a merge in another direction. In many workflows you're basically merging in order to keep two branches as similar as possible - for example, taking changes from a development branch into a production branch, and maybe moving critical bugfixes from the production branch back to a development branch. In this sort of workflow, you typically wouldn't want to diverge when merging two branches (you want that critical bugfix in both branches, after all) so it's not obvious why you would have to resolve the merge conflict both times, but that's certainly not the only workflow when working with branches.
I used to work on a Java project that had some utility libraries that we shared with a group working on a different project. At some point, our libraries needed to diverge from theirs for various reasons, so we took a branch of their project and both groups made unique changes to the library. Sometimes it happened that we would fix a bug and sometimes it would happen that they would add a new feature, so we frequently merged back and forth with each other.
You can see here that the results of merging from our branch to theirs should not necessarily be the results of merging from their branch to ours. Let's assume that there was a file where we added some new methods and maybe fixed a few bugs. And let's assume that they'd added a few different methods. When they merged our changes into their branch, they'd get a merge conflict and let's assume they took the bugfixes but did not take our new methods since they didn't need them. Now when we do a merge to get their changes into our branch, we still get a merge conflict - this allows us to take their methods into our file.
If TFS were to make some assumption about the merge from their branch into ours based on the results from our branch into theirs, it would be inaccurate.