This boils down to:
1) The purpose is not B, but A.
2) The purpose is A, but not B.
They have a significant difference in feeling. I mean, you could replace 1) with 2) and it means the same, but the feeling is much different.
In 1), there is some expectation that B might be the real purpose, but it's really not. Instead it is A. But in 2), you are simply stating a fact: The purpose is A, but not B. Does that make sense?
You could say it this way:
1) The purpose is not B, as you might expect, but instead it is A.
1) The purpose is not B, which might be normal, but instead it is A.
Do you see the difference in feeling of 1)?