Honest question, I keep hearing this advice but have never personally used it. I've been stopped by law enforcement many times over the years, things like taking photographs, exploring abandoned buildings, launching model rockets, setting off illegal fireworks, etc. Each time I am respectful and fairly honest with the officers, with the goal of going about my business in the minimum amount of time and expense. I've never once been detained, and am rarely cited.
I suspect that if I don't talk to them at all they will take me downtown, bring me my precious lawyer, and after spending the night in jail be let go without charges or an apology. I don't know for sure that this is the case, but my personal experience has been that talking to police lets me go about my business.
If I were ever in a situation where things dragged on more than about 5 or 10 minutes I'd probably reconsider my approach, but I honestly question if this advice is sound.