Hello Datawizard,
Although Layer 3 switches also support Layer 2 services, the cost of layer 2 switches is cheaper.
In some scenarios that do not require a gateway, such as using a Layer 2 switch at the access layer is a more reasonable choice.

I hope this helps.