Software costs nothing to replicate. It's more advantageous to give hobbyists your software for free since they will not pay for any software and you can at least use them to make your software more popular.
You can not make money selling software to people who have $0 budget to buy it. Sell software to enterprises and give it away for free for OSS side projects.
Because enterprises take it for free. The way you can prevent this is to use AGPL licensing and charge money to use it under a comersial license.
The problem is now no one uses your software because there are endless amounts of more permissive open source software available that work just as well.