Why is it considered a crime if you lie while testifying before Congress, but Representatives seem to be able to say whatever they want without repercussions?
Why Lying to Congress is a Crime
Congress needs to be able to investigate to be able to properly draft legislation.
One of the most important nonlegislative functions of the Congress is the power to investigate. This power is usually delegated to committees -- either the standing committees, special committees set up for a specific purpose, or joint committees composed of members of both houses. Investigations are conducted to gather information on the need for future legislation, to test the effectiveness of laws already passed, to inquire into the qualifications and performance of members and officials of the other branches, and on rare occasions, to lay the groundwork for impeachment proceedings. Frequently, committees call on outside experts to assist in conducting investigative hearings and to make detailed studies of issues.
And lying in effect nullifies or thwarts the power of investigation. In in effect defeats this special purpose. The investigative power of Congress is extended to impeachment proceedings as well.
Why Can Congressmen Lie?
Because of Article 1, Section 6, the Free Speech and Debate Clause of the Constitution.
They [ed note: Congressmen] shall in all Cases, except Treason, Felony and Breach of the Peace, be privileged from Arrest during their Attendance at the Session of their respective Houses, and in going to and returning from the same; and for any Speech or Debate in either House, they shall not be questioned in any other Place.
Jim Wilson, one of the Constitutional Framers, put it this way:
In order to enable and encourage a representative of the publick to discharge his publick trust with firmness and success, it is indispensably necessary, that he should enjoy the fullest liberty of speech, and that he should be protected from the resentment of every one, however powerful, to whom the exercise of that liberty may occasion offence. Lecture on Law (1791).
A good contemporary summary:
The speech or debate clause is a clause in the U.S Constitution protects members of Congress from prosecution for any speech or debate in the House, other than treason, breach of peace, or felony.
The protection of this clause is not limited to words spoken in debate. Its protection extends to committee reports, resolutions, and the act of voting, and any things generally done in a session of the House by one of its members in relation to the business before it. Thus, so long as legislators are ''acting in the sphere of legitimate legislative activity,'' they are protected not only from the consequence of litigation's results but also from the burden of defending themselves.
The protection allows the legislators to do their job without fear of blowback or retribution from the executive mostly, and from individuals with agendas. It promotes the separation of powers and ensures an open forum and safe space for Congressmen. It is very close to absolute, even if the Congressmen is committing a crime while in the process of legislating. (Continuation from the Wilson link above.)
If a Member's actions meet the "legislative process" test, his immunity is absolute; and that is so even if he has acted contrary to law. Accordingly, although the government may prosecute a Member for a criminal act, such as accepting a bribe, it may not pursue the case if proof of the crime "depend[s] on his legislative acts or his motive for performing them." United States v. Brewster.
In Eastland, the Supreme Court acknowledged that the clause may shield Members from civil or criminal liability "even though their conduct, if performed in other than legislative contexts, would in itself be unconstitutional or otherwise contrary to criminal or civil statutes." The risk of such abuse, however, "was the conscious choice of the Framers' buttressed and justified by history." Errant Members nevertheless remain subject to disciplinary action by their respective Houses for "disorderly behavior"—and, of course, by their constituents on Election Day.
Because Congress makes the rules. I can't see them passing a law (it would probably even have to be constitutional amendment) that Congressmen need to tell the (full) truth while investigating someone. Even the police are allowed to lie to suspects in some regards, although that probably varies by state somewhat.
For example, the U.S. Supreme Court has allowed police to falsely claim that a suspect's confederate confessed when in fact he had not (Frazier v. Cupp, 1969) and to have found a suspect's fingerprints at a crime scene when there were none (Oregon v. Mathiason, 1977).
As for why not allow lies from the person interviewed... Because that limits their freedoms to the advantage of the interviewer. A similar restriction (18 U.S.C. § 1001) exists in the US when the FBI is interrogating etc. Some US states have similar laws for lying to the police, e.g. Missouri has MO Rev Stat 575.080. The powers that be decided they want this power and the citizens didn't think it worthwhile to rebel over this in some way. Arguably, this limits some types of infractions, like covering up things, making nuisance reports etc.
Of course one can come up with more elaborate justifications for these facts, but the cynical version is what I wrote above.
The US judicial/constitutional view is that only the "negative" defense allowed is not talking. This comes from the 5th Amendment:
American law generally is aggressive in criminalizing lying, in part because it offers citizens an alternative if they fear the consequences of telling the truth to a government official.
That alternative is found in the Fifth Amendment’s protection against compulsory self-incrimination. It affords individuals a right to remain silent and allows them to avoid speaking damaging truths. When it was added to the U.S. Constitution, the Fifth Amendment was partly a reaction to abuses perpetrated by England’s Courts of Star Chamber, which operated from 1487 to 1681. Those courts were used to suppress opposition to royal policies, and they used torture to exact confessions from the King’s enemies. [...]
However, as the late Justice Antonin Scalia once explained, “Neither the text nor the spirit of the Fifth Amendment confers a privilege to lie. ‘[P]roper invocation of the Fifth Amendment privilege against compulsory self-incrimination allows a witness to remain silent, but not to swear falsely.’”
But for a bit more history, this strict interpretation is somewhat new, dating to the 1930s:
The prohibition of false statements traces its origins to the Civil War, when Congress reacted to a “‘spate of frauds’ submitted by military con artists scamming the United States War Department.” It forbade people in the military from making fraudulent requests for payments from the government. Soon, however, the law was broadened to include similar requests when made by any person or corporation.
To successfully prosecute someone for making a false claim, the government had to show that that the accused cheated the government out of money or property. In the 1930s, Congress removed the requirement that there had to be a resultant financial harm. This constituted a substantial departure from what the legal commentator Giles Burch calls the traditional view that “police authority does not… include the power to punish suspects who lie.”
And yes, those are the same rules that apply in lying to Congress
Q: What are the rules about lying to Congress?
A: Glad you asked. If you are testifying in front of Congress sometime soon, and are wondering how far you can bend the truth, there are a two key statutes governing perjury you need to be aware of: U.S. Code sections 1621 and 1001 of Title 18.
As for why are Congressmen given such wide latitude in their own statements, notwithstanding free speech later granted to everyone in the US in most contexts (1st Amendment) the US Constitution (Article I) is simply reflecting the more general common law idea of "parliamentary privilege":
Legislators in countries using the Westminster system, such as the United Kingdom, are protected from civil action for slander and libel by parliamentary immunity whilst they are in the House. This protection is part of the privileges afforded the Houses of Parliament under the Common Law (parliamentary privilege). Parliamentary immunity from criminal prosecution is not enjoyed by Members of Parliament under the Westminster system.
Thanks to the Speech or Debate Clause (Article, Section 6, Clause 1)
Members of the United States Congress enjoy a similar parliamentary privilege as members of the British Parliament; that is, they cannot be prosecuted for anything they say on the floor of the House or Senate.
Why this privilege/right exists for legislators is a bit of no brainer: to give them maximum political/speech liberties in their work. The quotes that K Dog gives explain this bit in detail.
Interestingly enough, not all US state constitutions seem to have an equivalent.
As an aside, the [state-level] parliamentary privilege (or legislative privilege as it's more commonly called in the US), which extends to documents as well, has been used to refuse judicial-branch access to relevant materials in some gerrymandering cases. (Edwards v. Vesilind is an example.) This is probably a more controversial use of the privilege than them going on a questionable-truth tirade in a committee while deposing someone. So, going full-circle here, you can see how too much freedom/privilege can facilitate some forms of coverup.
It is a crime to lie to Congress because Congress passed broad laws making it a crime to lie to federal officials, including the legislative branch:
The two most relevant statutes:
(a) Except as otherwise provided in this section, whoever, in any matter within the jurisdiction of the executive, legislative, or judicial branch of the Government of the United States, knowingly and willfully—
(1) falsifies, conceals, or covers up by any trick, scheme, or device a material fact;
(2) makes any materially false, fictitious, or fraudulent statement or representation; or
(3) makes or uses any false writing or document knowing the same to contain any materially false, fictitious, or fraudulent statement or entry;
shall be fined under this title, imprisoned not more than 5 years or, if the offense involves international or domestic terrorism (as defined in section 2331), imprisoned not more than 8 years, or both.
This statute, versions of which go all the way back to 1863, is extremely broad, and is often used to charge people for lying to federal investigators (see Martha Stewart, Michael Flynn, or Rod Blagojevich). Section (c) clarifies that it also applies to the legislative branch:
(2) any investigation or review, conducted pursuant to the authority of any committee, subcommittee, commission or office of the Congress, consistent with applicable rules of the House or Senate.
The federal perjury statute, 18 U.S. Code § 1621, can also apply to Congressional testimony:
(1) having taken an oath before a competent tribunal, officer, or person, in any case in which a law of the United States authorizes an oath to be administered, that he will testify, declare, depose, or certify truly, or that any written testimony, declaration, deposition, or certificate by him subscribed, is true, willfully and contrary to such oath states or subscribes any material matter which he does not believe to be true; or
(2) in any declaration, certificate, verification, or statement under penalty of perjury as permitted under section 1746 of title 28, United States Code, willfully subscribes as true any material matter which he does not believe to be true;
is guilty of perjury and shall, except as otherwise expressly provided by law, be fined under this title or imprisoned not more than five years, or both. This section is applicable whether the statement or subscription is made within or without the United States.
Does this apply to members of Congress in the official practice of their duties?
No. There is a specific exclusion in the Constitution itself (Article 1, Section 6):
The Senators and Representatives shall receive a Compensation for their Services, to be ascertained by Law, and paid out of the Treasury of the United States. They shall in all Cases, except Treason, Felony and Breach of the Peace, be privileged from Arrest during their Attendance at the Session of their respective Houses, and in going to and returning from the same; and for any Speech or Debate in either House, they shall not be questioned in any other Place.
Laws passed by Congress (like those mentioned above) cannot contradict the Constitution; so this exception means (broadly speaking) that members can, as you put it, "say whatever they want without repercussions".
If you want to dive deeper into the history of interpretation of this exception, there are lots of resources out there, including this long and comprehensive Congressional Research Service document (PDF), which concludes as follows:
The Speech or Debate Clause is perhaps the greatest constitutional bulwark against inappropriate executive or judicial intrusions into both the functioning of Congress as an institution and the representative role of individual Members. The Clause seeks to ensure an independent legislature by providing Members with immunity from liability for legislative acts in both criminal and civil cases. That immunity appears to be complemented by both an evidentiary and a testimonial privilege that protects against the compelled disclosure of information reflecting those acts. However, the scope of those privileges, especially with regard to the disclosure of documents for nonevidentiary purposes, is subject to debate among the federal courts. The issue would appear to be ripe for Supreme Court review.
Criminalization isn't necessary
Congress has inherent contempt powers, which they can exercise to punish disrespectful, untruthful, and/or etc. people before it. You will not find this expressly listed in the Constitution, though. It was ruled by the Supreme Court in Anderson v. Dunn (1821) to be a necessary power attached to the legislative power: Congress relies on the testimony of witnesses and experts to create legislation and conduct oversight, and it cannot effectively and sovereignly legislate if it can be defeated and confounded by misbehaving or untruthful witnesses/experts. As such, no statute is necessary for Congress to compel accurate testimony on pain of punishment. They can do so by virtue of their explicit legislative power.
But it can and has been expressly criminalized
While Congress did for a time directly exercise their inherent contempt powers, last doing so in 1934 (see Jurney v. MacCracken), it started to become impractical. Supreme Court rulings had limited the duration of the imprisonment to the end of the current session of Congress, and the process itself was often time-consuming. The political optics of doing so were also problematic, as it was too easy for it to appear to be a partisan attack on political opponents, rather than a legitimate legislative act to ensure Congress has accurate information. The executive branch was usually responsible for arrests, imprisonments, prosecutions, etc., making them a more palatable and trusted option for such actions, and they could more easily absorb the time and resource costs (because you can just hire or appoint more people to the Executive branch via congressional laws, whereas Congress is strictly limited to Representatives and Senators). So ultimately Congress passed a law in 1857 that made contempt of Congress into a specific federal crime, which was then handled and potentially prosecuted by the executive branch via the Department of Justice.
This largely solved the inefficiencies and unpleasant political optics of exercising inherent contempt powers. Though in the last few administrations we have seen something of a perverted resurrection of these issues, with the Attorney General of multiple administrations being held in contempt of congress via this statue, which the DoJ (which is headed by the AG) then refused to prosecute. Although some congresspeople have talked about the idea of using their inherent powers to keep the AG and the DoJ, and much of the executive branch in general, held to account before Congress on contempt charges, nothing serious has actually developed in this regard to date.
But none of this does or can apply to Congress itself
Due to the Speech and Debate clause of the constitution, the members of Congress have pretty much absolute immunity to all statutory and constitutional claims against their acts made during legitimate legislative activities, with very few exceptions. No law of Congress can supersede this (or any other) constitutional protection. So the members of Congress can lie and misbehave all they want during their duties without it being a crime.
The constitutional check on this is that the chambers of Congress have express constitutional power to dictate their own rules and to censure and expel their own members. And voters can reward or punish their Representatives and Senators for such behaviors at the ballot box. Both chambers have set rules of debate that dictate how their members are to act, all designed to ensure a respectful, collegiate, and productive discourse. Failure to comply with these may result in losing their debate time, (consideration for) committee positions, etc.
The simple answer is: when someone testifies before a congressional hearing, they are sworn in, just as one is sworn in when they testify before a court of law, and held to the same standards of truth and completeness as they would in a court of law.
When a member of Congress speaks, they aren't sworn in, and not subject to penalties if they don't speak the truth, just as a person not under oath outside of a courtroom is free to say whatever they wish, facts notwithstanding.
The key issue here is whether the person in question is a witness in a hearing, or a member of Congress speaking in general.
In the end, it is up to the citizens that elected a member of Congress, to decide if that person has or has not been telling the truth... in the next election, or in particularly egregious cases, by recall.