Going undercover is an artful way to gather intelligence that can't be obtained from searching records or conducting a surveillance.
An undercover investigation involves making direct contact with subjects and situations under a pretext. It works well for competitive intelligence investigations.
For example, by posing as a customer, I can find out why a business may be getting a lot of bad online reviews. Or how much other companies are charging for the same service you provide. Or what a more successful competitor is doing that you're not, but should be.
Aside from competitive intelligence, undercover pretexts can also be used in fraud investigations and to assist in debt collection efforts.