First of all, let me start by saying this is not an easy question to resolve. Hopefully, my attempt to answer will add to our journey of understanding and not make it more confusing.
The traditional interpretation of Genesis 37: 26-28 is that the brothers sold Joseph into slavery. I say "traditional" because - of course - not everyone agrees.
The disagreement comes from Gen. 37:28 - but is reflected in your question about Gen. 42:21.
In this case, we have to pay attention to what is NOT said in Gen. 42:21. The brothers think Joseph can't understand them but they never mention "selling Joseph into slavery." They mention his distress, but not that they participated in the selling. Why not specifically mention what they did?
This takes us back to Gen. 37:28 and a problem with translation. Here are two different English versions:
Then Midianite traders passed by; so the brothers pulled Joseph up and lifted him out of the pit, and sold him to the Ishmaelites for twenty shekels of silver. And they took Joseph to Egypt.
(the words "so the brothers" are italicized in the NKJV because they are added into the English. Those words - the brothers - are not in the original Hebrew.)
Here is the ESV:
Then Midianite traders passed by. And they drew Joseph up and lifted him out of the pit, and sold him to the Ishmaelites for twenty shekels of silver. They took Joseph to Egypt.
(who is "they?" In the original Hebrew the "they" are the Midianites...not the brothers)
This, of course, leads to the other interpretations as biblical scholars are attempting to solve the issues of "who pulled Joseph out of the pit?"
Most Christian scholars - based on source criticism - smooth over these inconsistencies by saying that two different source documents were brought together and not cleaned up well enough by the editors.
Many Jewish scholars do not follow this but rather they go by the plain meaning of the text. If it says the Midianites pulled him out then it was the Midianites who pulled him out. One Jewish scholar, in particular, is Rashbam (an acronym for RAbbi SHmuel Ben Meir)
Using this line of thinking then the brothers would truly not have known what happened to their brother. In Gen. 42:21 they would be genuine in only knowing the distress they saw on Joseph's face when they left him in the cistern.
Here is a good explanation from Bar-Ilan University: Here
Again, hope this helps you on your journey. There are MANY scholarly articles written on this inconsistency so we are not the first to venture down this path - and I'm sure won't be the last.