That is not necessarily true. When you buy in the secondary market, there is a wide choice available to you. In the case of IPOs, many of them tend to be attractively priced. Also, most of these IPOs in the last couple of years have listed at a premium to their issue price and have also sustained. However, that trend has changed in the last few months with IPOs increasingly priced very aggressively and therefore disappointing on listing. That has built a lot of retail confidence in IPOs. Lastly, the allotment mechanism in IPOs tends to favour small investors since the primary goal of the allotment process is to ensure that all eligible applicants at least get the basic minimum allotment. This vastly increases your chance of getting an allotment, even if the issue gets oversubscribed.
However, like in case of secondary market investing, it is only the quality companies with sound business models, robust cash flows and healthy returns on equity that actually give returns to investors. To that extent, there is not much of a difference between an IPO and a secondary market investment. Just look at the recent IPOs. Stocks like Avenue Supermarts (D-Mart brand) and Shankara Building Products, which appreciated many times over in the last 1 year are more the exception than the rule