I have a friend who took this advice way too literally when we were 18.
I was in the car when he got pulled over for speeding once, and he refused to say a single word to the officer. He handed over his license, registration and proof of insurance, but wouldn't answer any questions.
The cop asked how him how fast he thought he was going, and my friend didn't even tell the cop that he wouldn't answer his questions. It was just the straight silent treatment. The cop was clearly getting agitated. I was begging my friend just to answer the questions, even if just say he didn't remember or something, but he refused.
Fortunately, his grandma is in the backseat and really saved the day by apologizing for her idiot grandson. My friend wound up only getting a warning thanks to his grandma, but no doubt we would have gotten a big ticket at the minimum if he kept the silent treatment up.
Another time, we both got busted for launching bottle rockets in a public park a couple weeks after the 4th of July. There were several witnesses including the people that called the cops, but once again my friend did the exact same silent treatment to the cops. I sang like a bird about my own actions while being careful not to say that my friend had also launched rockets.
Fortunately the questions were directed at both of us, and we weren't asked specifically who all was involved before my friend felt guilty that I was taking all the blame and started talking to the cops himself.
Good thing because in Ohio launching bottle rockets is an M-1 misdemeanor carrying up to a six month prison sentence. The cops could have been jerks, but instead they recommended that the prosecutor drop charges after we did some community service. Had my friend stuck with the silent treatment, I fully believe we would have been punished more severely.
Again I urge common sense. Every situation is different. Had it been someone else or somewhere else or a slightly different situation, being quiet could have been the right decision. This could be an example of white privilege, but so far in my life, I've never regretted just being honest with the cops.