illustration (attribution, if any possible, is at the end of the article)
« Buddha does not deny his evil nature; he has mastered evil. Because he has mastered evil, he is not affected (or stained) by it, and he does not practice evil. He therefore does not hold (is not mindful of) evil for long. [but] Because he can freely control evil, he is able to use this knowledge to lead people to salvation. He uses evil day and night but is never stained (by it). »
— Chang-an, Kannon-gengi
The Kannon-gengi (Jpn.; Chin.: Kuan-yin-hsüan-i), 観音玄義, or « Profound Meaning of the "Perceiver of the world's sounds" chapter » is a a commentary on the 25th chapter of the Lotus Sūtra, attributed to a student of Chigi (Jpn.; Chin.: Zhiyi), 智顗.
The work does not refer to the principle of "three thousand realms in a single moment of life", so it is thought to have been compiled prior to « Great Concentration and Insight » by Chigi. Therefore, this excerpt probably records a precursor —or a draft— of the final concept.
See also gplus.wallez.name/RSEqmZacaJ6
The idea that the Buddha knows evil is difficult to hear for some buddhists, but it makes sense. In order to help others, a buddha needs to know (including while he teaches…) what defilements are 'like'; (s)he needs to know how to discern them and how to overcome them.
Although this might be difficult to accept, the Buddha himself said as much:
I told Māra the Evil One: « I know you, Evil One. Don't assume "He doesn't know me." You are Māra, Evil One. And Brahma, and Brahma's assembly, and the attendants of Brahma's assembly have all fallen into your hands. They have all fallen into your power. And you think "This one, too, has come into my hands, has come under my control." But, Evil One, I have neither come into your hands nor have I come under your control. »
— Brahma-nimantanika sutta (MN 49)
Similarly, when Māra claims control of conditioned phenomena (which the Buddha agrees with, as he teaches that dukkha is a characteristics of conditioned phenomena), the Buddha asserts his attainment of the unconditioned (nibbana)…
Then Māra the Evil One —sad and dejected at realising, "The Blessed One knows me; the One Well-gone knows me"— vanished right there.
— Kassaka sutta (SN 4.19)
Knowing evil is not reserved to the Buddha. For example, the nuns in the Alavika sutta (SN 5.1) and Vajira sutta (SN 5.10) obtain the same result: « Then Māra the Evil One, realising "The nun knows me," sad and disappointed, disappeared right there. »
This 'knowing' is not to be interpreted as knowing something static, or some entity. It is certainly not equivalent to a clear pre-conceived set of rules and certainties.
It manifests as understanding how some thoughts (e.g. unhelpful doubts) would causally lead to unwholesome consequences; it manifests as seeing causality.
Therefore all thoughts are possible, including evil thoughts… but buddhas refrain to act on unwholesome thoughts, out of discerning the consequences that would arise if they did (and out of being free from biases and tendencies that would force them to 'automatically' act on —or 'react' to— such thoughts)!
The Kannon-gengi is clear: thoughts arise, but by not clinging to them, by not perpetuating them, by not fuelling them (giving them weight by further thoughts, speech or acts), they cease. Buddhas don't cling! Unconditioned peace is attained again. It is clear from the Canon that the Buddha could re-realise nibbāna whenever he so wished, but that he was engaged daily in the conventional world! In Buddhism, Peace is constantly re-created rather than some 'static' Paradise separate from some 'static' Evil.
Doctor Ts’ui asked “Does an accomplished person go to hell or not?”
The master said “I entered at the head of the line.”
The doctor asked “You are an accomplished person. Why do you go to hell?”
The master said “If I had not gone, how could I have met you?”
— The Recorded Sayings of Zen Master Joshu (amazon.com/gp/product/157062870X/ref=as_li_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=157062870X&linkCode=as2&tag=koanmu03-20&linkId=G73EBBNSH23FPWGP)