Penalty and prosecution are two different things.
Penalty is imposed if the assessee has wilfully tried to evade tax or had not disclosed full income.
There are different types of penalty u/s 270A, 271C, 271F etc. They are for different purposes for not filing ITR, for accepting loan in cash.
Prosecution is a extreme situation which is mainly done if the assessee doesn't pay his due taxes even after repeated reminders or tries to transfer property to save himself from recovery of tax.
There are various immunity from prosecution and penalty but it all depends on the facts of case.
There is still no compounding principle in direct tax as is available in Indirect tax.
Hope you find the information helpful if you do please rate it 5 and provide your valuable feedback for my improvement.
Thank you