Impact cardio vs non impact

I have found that my best results are on the treadmill but my knees and ankles hurt. I do not feel the same using either the bike or elliptical. Any ideas?