It's only legal if both parties agree to it.
You as the buyer have the right to choose your own title/escrow company. And generally, you as the buyer pay for your own title insurance.
However, there are times when this item is negotiated.
If the property is an REO (bank-owned), they usually have their preferred title companies. If you agree to use their preferred company, you can specify that the seller will pay for title insurance. And generally, they do.
If the seller opened a pre-escrow with a title company, and the preliminary report is already available, the seller may have considered that as an extra service or information to provide to the buyer as part of the buyer's investigation. But you don't have to use that title company. If you do choose your own, you may be expected to pay your own title insurance as customary
In a competitive situation --- depending on whether it's a buyer's market or seller's market, many items are negotiable regardless of what expenses are customarily paid by either party.
As they say, everything is negotiable. And once everyone agrees --- it becomes an enforceable contract. And yes, that's legal.
Shouldn't you be asking your realtor this question?