https://mashable.com/article/elon-musk-spacex-ukraine-starli...
https://www.theverge.com/2022/4/8/23016670/starlink-spacex-u...
Any "free" service was always to demo the usefulness of the product to the DoD for them eventually to pay through the nose. Musk got flak for his comments because a) it was a half-truth b) he made it very publicly, c) he started promoting Russian government accounts on For You pages, and d) he started echoing Russian sentiments and/or falsehoods about the war.
If he had not done any of that he would have still gotten the money and not looked like a fool. No one expected Starlink to lose money on the deal, and they haven't.