Working on exact fee calculation in D18380. Apart from various complexities, it's also a tough UX problem to manage. When we do get it right, and a user really can max buy -- well, then they have no XEC left for any other actions. So we need to either have a notice for this or prevent it somehow.
For now, this is probably the best kind of solution. It's better than the user seeing an error whenever they try to Max buy. And it will never consume the user's entire XEC balance.
