I don't think that's a mathematical flaw. It's a different interpretation of something which isn't clearly defined anywhere I can see. What is said could arguably be fulfilled by HL knocking 5k off the remaining LISA balance and handing it to the government. Or, yes, they could insist it's paid outside the LISA.
I think that's a fairly dishonest interpretation of the words 25% charge, but accept it's probably reasonable to be conservative in something ill defined and at the whim of the government to change anyway.
But, having 21497 (20k out, 1497 in) rather than 22530 that you'd have for same investment in a regular ISA, that's only a 4.6% loss, not 6.3%. Yes the 1497 is still inaccessible, but you've satisfied a hypothetical burning requirement for 20k before you turn 60.
Imagining the same 5yr input, then ignoring it for another five years before the desperate need for 20k rears its head, I think you come out ahead. Regular ISA would have 7414 left after withdrawing 20k, LISA would have 7599 left after withdrawing 26667.
Also, if your urgent cash need is only 10k, (so 13333 hit to LISA) you're well up even after 5 years.
It appears to me you can only realise the loss relative to a regular ISA if you withdraw pretty much all of it after a pretty short elapsed time. In that case, sure, you shouldn't be putting money in a LISA.
My situation now (35yo), and probably a typical one here, is deciding on a savings split between the two. More in LISA makes a massive positive difference to NW and income aged 60+, but pushes out FI date a bit to avoid risking cashflow issue in late 50s if treating LISA as sacrosanct and drawing down ISA to near empty.
My LISA timeframe is maybe 5 more years of maxing it, nearly 20 years of ignoring it (at some point during which I could RE), and then a small risk of having to pull a year or two's barebone expenses out if the ISA savings don't perform/last as well as projected to take me to LISA/SIPP access age. This would be a pretty small portion of the LISA total by that point.
I'd not plan for that, but knowing you'd still be ahead in that situation is a good confidence boost for avoiding one-more-year syndrome.