I started to notice gaps after a year as a mild signal. A gap of 5 years was a strong signal and nearly every candidate I talked with had some level of hireability issue beyond the gap. Even a mother that decided to stay home till her kids were in school was going to have a difficult re-entry to the rigid expectations of the working world. After someone had be back in the workforce for a year or two and had some mildly plausible explanation for their 5 year gap, I stopped noting it as a downside. But experience older than about 12 years was often not factored in, so a person with a recent 5 year gap will just have less recent and relevant experience than someone who had worked 12/12 previous years.
My brother in law had something like a 5 year gap. He had a mental breakdown and went on disability. He's doing great now, but that first boss he had after coming back to work was a saint, putting up with so much emotional baggage and spent personal time coaching him out of giving up.
So, yeah, if you are taking on someone who has been out of the workforce for a long time, you take on lots of risk. But once they are back in the workforce and getting good referrals, the gap shouldn't matter as much.
(And seeing it first hand: if you are having mental health problems, staying home and playing video games for 5 years will NOT make it better).
Your brother in law’s situation is quite common. It’s exactly why this is a reliable signal on a resume to avoid or at least not be in the dark on candidates with baggage. There are very few saintly bosses out there ready to rehabilitate someone’s work ego and professionalism. As a recruiter, it was my job to find the warts on an otherwise excellent candidate so that the hiring manager could at least make an informed decision. Missing something big with a candidate reflected poorly on my attention to detail.
Rick Perry in a presidential primary debate wanted to eliminate three government agencies but couldn't remember all three on live television. He later become head of the Department of Energy, the same agency which he wanted to eliminate but forgot during the debate years earlier.
They where profitable and paid net taxes in 2016 and where hugely profitable yet paid zero taxes in 2017, 2018, and 2019. So I don’t see how this could be loss carry forward offsetting a several billion dollar annual tax bill for 4+ years.