I was considering doing this almost exactly two years ago (August, 2021) using a company then called VBit. (They rebranded as "Advanced Mining".)
I made a spreadsheet analyzing five different levels of their service ("Silver"/$3.6k to "Black Diamond"/$88k) over 2- and 3-year service contracts, versus just buying and hodling the equivalent dollar investment as BTC. (I chose 2- and 3-year contracts so I could avoid the complication of having to account for the next halving.)
The results, when taking into account their default assumptions, hardware costs, hosting costs, and a wide range of possible end values of 1 BTC ($20k to $500k), were initially ALL positive. Even with the very pessimistic $20k BTC price, mining would have yielded you a few percent better outcome than hodling.
BUT, once you factor in an increasing global hash rate (leading to decreasing yields over time -- which we've certainly seen over the last 24 months!) and/or having to pay annual US income taxes on your mining income, there isn't ANY situation in which the mining beats hodling. Hodling ALWAYS wins out, usually by triple-digit percentage points.
Mining is for the big players, and even they have to manage very tight margins. There's no way you can compete with them while also paying high electricity costs (minimum $0.07/kWh) and the overhead of a management company. Plus you're taking on all the counterparty risk of that hosting company.
Just take that fiat you would've "invested" in the mining and buy and hodl bitcoin.
And I think it's Michael Saylor (correct me if I'm wrong) who says you don't need to earn "yield" on your bitcoin, because as bitcoin absorbs industry after industry over time, all of the value added by those industries (productivity gains) accrue to the purchasing power of your bitcoin.