The gemara says that R' Simlai would have counseled a mamzer to marry a shifcha to make his children mutar l'kahal based on R' Tarfon. The gemara questions whether the right to marry a shifcha is even l'chatchila or only b'dieved (since there is an issur to be a kadeish that should apply to a mamzer as well). Even on the tzad that one cannot marry a shifcha l'chatchila, the gemara says that R' Simlai would have advised stealing so that the can be sold as an eved ivri and then be permitted to a shifcha. The Tosafos Rid explains that it would be permitted to steal with the intent of eventually paying back, since it is being done for the purpose of being m'etaher his children. But, the Maharsha asks that it should still be problematic, because the children that the eved ivri has with the shifcha will be owned by the master and he will not be allowed to free them since it is a violation of לעולם בהם תעבודו?
R' Elyashiv points out in his sefer that the maharsha only asks the question on the gemara, but not on the mishna. Why doesn't he ask on the mishna itself that the entire approach of R' Tarfon requires the master freeing the children which would be a violation of freeing an eved. R' Elyashiv explains that based on the Ran in Gittin that this issur of selling an eved follows the rules of "lo sei'chanem" - it cannot be done for the benefit of the eved, but can be done for the benefit of the master, there is no question. R' Tarfon would advise that the Mamzer purchase a shifcha to be owned by him so that the children he has with her will be avadim that are owned by him. When he allows them to go free, it is for his benefit of being metaher his own children. The question can only be asked on the gemara where the method of having children with a shifcha will involve being sold as an eved ivri, in which case the children will be owned by someone else and not by him.