The question is more complicated than you might think. Let’s break it down.
Which is cheaper?
There is no universal answer even to this one-dimensioned question. Shopify is usually cheaper to start, but it charges you a monthly fee forever after. Shopify fee depends on your e-commerce revenue. In general, Shopify is cheaper for e-commerce websites with less than 50 000 visitors a month. Afterwards, it might be more interesting to have a freelancer or even an in-house team and a custom website.
Which has more performance?
Shopify has a very decent web performance compared to other platforms (WordPress, Wix). A custom website might be even faster – but you’ll need to put extra efforts. If your custom website isn’t optimized enough, it can be a nightmare in terms of UX. So, a custom website wins here – but only if you have the resources and skills to make it well.
Which has more flexibility?
A custom website is usually more flexible. Especially if you follow the principles of headless architecture and use the best-in-breed microservices. But integrating and managing them requires some time. On the other hand, Shopify has a rich set of plugins and integrations.
As you see, there are plenty of parameters to take into account. As a rule-of-a-thumb, go for custom website if you know why you need it and have the resources to implement it well. Otherwise, if you are new to e-commerce or have small resources, consider Shopify (and its alternatives like BigCommerce).