The cheapest mac that solved my bottleneck (ram) was a $900 Mac Mini but that computer had no upgrade room and I recently got a 4k display and I didn't want to find out whether the Iris graphics were up to the task.
I built a badass linux box for $850 - Ryzen 1600, 1050 ti, SSD, 32 gb of ram. It's hard to make an linux to apples comparison because mine is just a desktop and most macs come with displays but the apple premium just wasn't worth it.
I had a few issues out of the gate (not getting it running, but installing Nvidia drivers and getting tensorflow to use GPU acceleration) but it was an excellent learning experience and a few hours of time (which was honestly an enjoyable use of time) saved me considerable money over Apple. My desktop is the performance peer of an $2,400 iMac.
I'd pay a premium for an Apple but not 3x as much. And I'll probably continue to use a Macbook as a secondary device but when my Macbook fails, it's going to be harder and harder to shell out Macbook money when I know that a used Lenovo with Ubuntu will get the job done.