For many of us we already have a decent “donor” bike. So that’s not an additional cost. I had a Specialized hybrid city/dirt bike that cost $800 in 2018. It has a basic build quality of Alevio 2X9, Suntour fork, and Tektro hydraulic brakes and 29” wheels. So good enough.
The rear hub drive kit cost $750 and the build took maybe 10-hrs.
So yeah, I have $1,600 total into it but only $750 in new money. I had all the tools and a good bike stand so that was “free.”
Another consideration right now is availability. Good luck getting a decent factory built eBike without a very long wait.