As far as I know, this effect cannot be eliminated by any practical means, other than stratifying the subjects into groups according to type of drug, dosage, duration of use etc. and use statistical testing to look for any differences between the groups with, e.g., linear mixed modeling.
However, a cursory search on Google Scholar yields multiple studies where unmedicated folks were successfully recruited ininto the study, e.g. Kraguljac et al. (2016).
Reference
- Kraguljac et al., Schizophrenia Bull (2016); 42(4): 1046–55