This doesn't really go into how it's legal, but the situation around VoLTE has been difficult. It hasn't just been every phone working perfectly. Beyond that, it's possible to buy a phone that sort-of works.

For example, let's say that you're an AT&T customer and AT&T has 700MHz, 850MHz, 1900MHz, 1700MHz, and 2300MHz spectrum. You buy some foreign phone that supports 1900MHz. Great, now you're running a device that won't have coverage everywhere that AT&T has coverage. You're running a device that won't be using the full AT&T network and your speeds will be really slow compared to devices that fully support the network. You go somewhere with friends and you're like, "AT&T never works when I leave <city-name>!" Except that AT&T isn't the problem - you're the problem. You complain that your device is always slow and how AT&T is crap - but it's your device that's the problem.

Semi-compatible devices are just terrible for network operators. Let's say that AT&T wants to move that 1900MHz spectrum to 5G - but now you have a device that will stop working. Do they need to reach out to you? Do they need to offer you an upgrade? Sure, you and 90% of people would be like, "I knew what I was getting in for and it's my problem." But omg the 10% of people that will yell and scream and the meetings you'll need to have with regulators and the delays in your plans and the free devices you'll offer them as part of a settlement and all the mailings and admin.

Offering tech support isn't cheap and it's more expensive when you're dealing with random crap from users. Now you have some rep on the phone who doesn't totally know what they're talking about trying to figure out why they're getting bad coverage on their kid's device while their device has good coverage. They don't want to hear, "well, you shouldn't have bought some POS off Amazon that isn't even meant for the US market." They're going to say that it's a compatible phone - compatible being a black/white issue, not something that's only partly compatible and will technically get coverage 80% of the time, but even then won't be able to use most of the network.

Part of it is a cultural thing. Americans are willing to accept that companies are evil and don't allow something. You'll go online and say, "how is this legal" and then go back to your life and the company has spent no money on you. But once something is allowed, there's no concept of "we'll allow this, but you're on your own if anything goes wrong and we'll charge your account $100 if you call us for support." Once you've been accepted as a paying customer, you (and by you, I mean at least 10% of the people who will do that) will demand the same premium service for your dollar.

"AT&T only allows certain phones." Ok, companies are crap, but we're all used to that. If they allow you to put a crappy device on their network, there's so much bad word of mouth, regulator crap, support complaints, etc. I'm not saying the world should be this way, but it certainly is.

So many restrictions that exist are there because the company loses almost nothing from the restriction while the pain in the ass they receive from not having that restriction simply isn't worth it. Keep that in mind when thinking about why companies do things that seem to have no benefit. A bunch of people were likely a complete pain in the ass over something that was the customer's fault, but that the company ultimately had to deal with.

And I think the big area is foreign phones. Phones made for the US that have the right network support for the carrier are good to have. Someone grabs a Galaxy A32 meant for non-US markets (rather than the A32 5G) and it doesn't support bands 12/13/17 which are the main coverage bands for T-Mobile/Verizon/AT&T. It does support bands 2 and 5 and AT&T and Verizon probably have ok coverage in cities with band 2, but in-building coverage will be worse and speeds will be slow. I think they have some band 5 LTE, but they weren't necessarily anticipating that being one of the bands customers would really be relying on. And now there's an angry customer, spreading their anger to their friends, tying up support resources and costing you money, using your network inefficiently, and demanding that the carrier fix the situation and the only way you can fix the situation is basically by giving them a free phone.

In terms of how it's legal, spectrum licenses didn't come with open access requirements. The one exception was Verizon's 700MHz licenses. Except that Verizon kinda redefined open-access to mean that they wouldn't lock their phones - not that you could use any phone you wanted on their network. Google had pushed for the open access requirements, but a decade later Google didn't care and regulators didn't care.