Where in Europe? In the Netherlands all the calculations I ran every 2 years showed anywhere from slight to major discounts for 2 year contracts paired with a phone, and that's without discounting future cash payments (or valuing money you're paying upfront, either way).
It's still beneficial to phone companies because it makes phones look cheaper than they actually are ($30 a month feels more doable than $720 upfront) and so it's probably easier to sell a $30 a month cost for 2 years than selling a $720 cost even though (ignoring time value of money) they're the same.
And then if you add say a $20 phone plan, it's basically: want to pay $50 a month, or $30 a month and pay $720 now? The latter is probably easier to swallow for most and easier to sell, but that's of course entirely different from being a scam.
So for example, the Netherlands. Apple's shop sells the iphone for 700 euros. KPN (one of the 3 networks) has a one-time 53 euro, 2 year 54 euro plan, so 56 euros per month on average and the phone & plan is included.
A similar plan with the same KPN is €32.50. Add that to the 700 euro cost of the phone over 24 months (€29) and you're at 62 euros, vs 56 euros, more than 140 euros of discount and that's without valuing the financial/convenience value of not having to pay 700 euros upfront.
And this is literally the first, standard plan I looked into, no cherrypicking. (5gb a month plan, no limit calling/texting). Perhaps you could find different results but I've, purely as part of my buying decisions when I bought my own phone, ran these calculations here about every year or every two years at different carriers and it's consistent. So I'd say, it depends on the country.
As for prepaid, it's absolutely horrible here in the Netherlands. It's 30c per minute for calling, 16c per text, 25c per megabyte. Not kidding. That's KPN by the way, the same that offers the above plans. That means if you call say 300 minutes per month, that's 90 euros already. And that's just a little over calling 1 hour per week. Call 30 minutes per week and it's 36 euros. Add a 700 euro iPhone and you're already well over any KPN plan you can get, and you haven't used any data or texts yet. The 5 gigabytes of data the plan has would cost you 1250 euros per month if used in prepaid. Even using just 500 megabytes per month (my plan 5 years ago) would cost you 125 euros per month, prepaid.
KPN's prepaid is disproportionately shitty though, it's meant for old people really. Like my grandfather has it and he mostly just calls for cabs, emergencies etc. T-Mobile's rate in the Netherlands is more sensible, but still 5c per megabyte. A 1 gigabyte monthly data usage still costs you 50 euros, but such a 1 gigabyte plan would cost you less than 20 euros with minutes included. Prepaid here is never, ever a good option, unless you're an extremely light user like my grandfather, or someone who travels tons and doesn't return (as you can freeze plans for vacations etc).