Your friend got it to credit to Miles & More because it had an LX code. Miles & More is the "home" program of LH, LX, and OS, so any flights with their code should credit regardless of operating carrier. UA on the other hand is not any sort of partner with El Al, therefore didn't credit, it would have had to have a UA code to credit to Mileage Plus.
I certainly understand it could be confusing since United is selling you the ticket, therefore it's easy to misinterpret that they'll credit miles for the entire ticket. Anytime when going off-alliance, it's important to look at whose code is on the flight and who is operating the flight.
You can probably retro credit to a Miles & More account if you have one, but it's a small number of miles and won't do you any good if you're not adding several other flights to the same account.