My friend told me that you can NEVER use a comma before 'that' but I think you can. Can someone clear this up for us?
Of course you can use that after a comma. Like any rule made up by a well-meaning teacher, understanding why it is sometimes true and what the exceptions are will make you a better writer.
It sounds like your friend's advice is specific to restrictive clauses, which are often headed by that. For a relative clause introduced by a relative pronoun (that, who, which, whom, whose), it is called restrictive if the information is essential to the sentence, that is, if the clause restricts or defines the meaning of a noun phrase; it is called nonrestrictive if the clause provides supplemental or additional information.
For example, the Walden University Writing Center uses these examples for restrictive and nonrestrictive clauses:
The book that she read was important for her literature review. (restrictive; the clause that she read specifies the book that was important for her lit review)
The participants who were interviewed volunteered to be part of the study. (restrictive; the clause who were interviewed specifies which participants volunteered to be part of the study)
Walden University, which is entirely online, has main administrative offices in Baltimore and Minneapolis. (nonrestrictive; which is entirely online gives added information about Walden but does not help specify the noun, as Walden University is already specific enough)
No comma is used before a restrictive clause; commas are used before and after a nonrestrictive clause. Because restrictive clauses tend to be headed by that and nonrestrictive clauses tend to be headed by which, your friend's advice would hold true in many cases - no comma should go before the that in a relative clause.
That said, there are other uses for that that may accommodate a comma. For example, take this usage of that is:
A relative clause is called restrictive if the information is essential to the sentence, that is, if the clause restricts or defines the meaning of a noun phrase
"That is" introduces a restatement or further explanation of what was just said. It is customarily preceded by commas. It is also sometimes followed by commas, though this is a source for greater debate even on StackExchange.
We could imagine other situations. What if a parenthetical statement, one customarily set off by commas, precedes that? Would we automatically delete the comma only because that appears? No.
While the majority of commentators believe, as we do, that result-based punishment in the criminal law does not advance the goal of deterrence, a minority of scholars contest this issue. (John Boeglin and Zachary Shapiro. "A Theory of Differential Punishment," Vanderbilt Law Review 70.5, 2017.)