This was true at one point in time. May be around 2 decades back. But engineering has gotten very lucrative due to the IT boom, overall growth in economy and general demand for engineers in a high growth environment.
Also engineering has a lower barrier to entry and pays better than what many physicians make these days. To make anything decent as a doctor you have to do your MD, which is expensive both in terms of investment of time and money. And even after that, the job at the hospital won't pay you anything close to what your average engineer at a MNC would get paid.
And then don't forget the fact that many engineers can make money through side projects, freelancing and take adhoc risks like doing start ups which isn't even an option to most doctors.