It's legal to lie to the police under questioning in most circumstances, i.e. "I didn't rob that guy" if you robbed that guy. The big exceptions are falsely identifying yourself and lying while reporting a crime.
You might be thinking of 18 USC 1001 which makes it a felony to lie to a federal agent, and is extremely broad (both in terms of of what constitutes a lie and who counts as a federal agent).