In Joomla 4, you can disable FrontEnd Module editing via...

Global Configuration > Site > Frontend Editing

 

joomla module noedit