I think this question goes to the core of what it means to be a Buddha, i.e. what it means to be Awakened, i.e. what Awakening (also known as Enlightenment) means.
Different spiritual traditions have different takes on the concept of Awakening and I am not an expert on exactly where the word âbodhiâ or the concept of Awakening comes from, wether itâs an originally Buddhist word and concept or wether itâs borrowed and reinterpreted from earlier traditions.
However, it seems quite clear to me that in Early Buddhism as taught in the Suttas, Awakening is synonymous with the âKnowledge and vision of freedomâ AN 10.1, AKA âKnowledge and vision of endingâ SN12.23, AKA âKnowledge of the destruction of the defilementsâ MN 51.
The destruction of the defilements comes through disillusionment and dispassion, which comes through true knowledge and vision, which comes through right samadhi, which comes through⌠ethics! (AN 5.24)
How are ethics fulfilled?
Through giving up greed, hate and delusion.
How are greed, hate and delusion given up?
Through the cultivation of the higher ethics, higher mind and higher wisdom (the Noble Eightfold Path):
âSo, monk, you should train in these three trainings: the higher ethics, the higher mind, and the higher wisdom.
As you train in these, you will give up greed, hate, and delusion. Then you wonât do anything unskillful, or practice anything bad.â (AN 3.84)
How does one train in the higher ethics?
By keeping the precepts:
And what is the training in the higher ethics? Itâs when a mendicant is ethical, restrained in the code of conduct, with good behavior and supporters. Seeing danger in the slightest fault, they keep the rules theyâve undertaken. This is called the training in the higher ethics. (AN 3.90)
Why should one keep the precepts?
Because acts born of greed, hate and delusion only give rise to more greed, hate and delusion (AN 6.39)
It is not possible to do an immoral act âwithout attachmentâ. I think in this case people confuse âwithout attachmentâ with âwithout remorseâ, or âwithout guiltâ or âwithout caring about the consequencesâ. Thatâs a different thing.
Immoral acts can only be done if there is greed, hate or delusion (AN 10.174), wether one is aware or not, destroying vital conditions for advancing on the path to Awakening.
For a Buddha (or an Arahant)
âŚbad unskillful qualities born of greed, hate, and delusion are cut off at the root, made like a palm stump, obliterated, and unable to arise in the future. (AN 3.69)
So, according to Early Buddhism, no, there cannot be an immoral Buddha (or Arahant).