There is wisdom in madness. King Lear has finally become wise in his later state in life. He is losing his mind, but finding his wisdom. He realizes that life is not about appearances. He has learned that the hard way.
To explain the quote, there is wisdom in madness. King Lear has learned what is important in life. By learning how superficial his two older daughters are, it is enough to drive one mad. Learning the truth about his daughters has literally driven King Lear mad. That explains the quote that there is madness in wisdom. Learning the truth about his daughters drives King Lear over the edge. He gains wisdom but loses his mind. One could say he finally finds his mind, but is losing his sanity. That is one way to deal with the harsh reality of the truth.
Learning the truth is often so disturbing. The only way to deal with it is to become mad. It is often so shocking to face the truth until it leaves one in total disarray. The quote is true. There is wisdom in madness and madness in wisdom.
Learning that his two daughters have never really loved him is a bit of wisdom that Ling Lear could have lived without knowing. Nonetheless, he does know the truth. Now, he is driven to madness in knowing the tragic truth.
The only way King Lear can survive the horrible truth he has learned is to totally lose his mind. There is madness in wisdom.