The following question and translations are courtesy of Studies in Bereshit by Nechama Leibowitz.
In Parshat Vayeshev, some pesukim suggest that Yoseph was sold by his brothers to Midianites, and others to Ishmaelites. The Ishmaelites are mentioned first ("Behold, a caravan of Ishmaelites...") followed by "And there passed by Midianites, merchants; and they lifted up Yoseph out of the pit and sold Yoseph to the Ishmaelites). This is followed by a third group known as Medanites (which Rashi suggests is simply an abbreviated form of Midianites) selling Yoseph to Mitzrayim, and ultimately concludes with the Ishmaelites selling Yoseph to Potiphar.
Rashi suggests that Yoseph was first sold by his brothers to the Ishmaelites. The Ishmaelites then sold Yoseph to Midianites AKA Medanites, who eventually sold Yoseph to Potiphar in Mitzrayim. Thus, when it says the brothers sold Yoseph to the Medianites or that the Ishmaelites sold Yoseph to Mitzrayim, the Torah is speaking of indirect action/figuratively.
This is all well and good, but Studies in Bereshit proposes the following question:
The following objections have been raised to Rashi's interpretation: What forced Rashi to explain that the brothers sold him to the Ishmaelites and the latter to the Midianites and not that the brothers sold him to the Midianites and the latter to the Ishmaelites, which would fit the text better? Explain which texts this explanation would suit better and why Rashi, in spite of this, preferred his explanation.
Try as I might, I was not able to come to any conclusions with this question - or, indeed, any manner in which the order would be significant at all! Mayhaps there is some connection between the tribes and Ishmael that is significant here, but I am not sure what it would be. I agree that the text is smoother if the order was brothers -> Midianites -> Ishmaelites -> Potiphar, as it refers to selling Yoseph right after the Midianites pass by, and says that Potiphar bought Yoseph "from the hand of the Ishmaelites" which suggests that there was direct interaction between Potiphar and the Ishmaelites. However, I can think of no reason why Rashi would forego this in favor of the order he proposes. Why does Rashi prefer the order he gives (brothers -> Ishmaelites -> Midianites -> Potiphar), rather than the one his objectors give (brothers -> Midianites -> Ishmaelites -> Potiphar)?