Closed cell foam is not water proof, it may be water proof in its intended application as a wall insulation but when buried in the ground it can break down and absorb water. I have seen it recently, the customer said it worked great for 4 years and this winter he started having growing issues as winter went on.
The gas inside the bubbles that make up closed cell foam do try to escape over time, this is one of the reasons logstor uses a membrane inside there pipe to stop this flow of gas out of the bubbles, this made for a much better and longer lasting product.
There is absolutely no way to ever achieve 0 heat loss.
The customer that had the spray foam had it probably 8 inches around his line set, the outside of the foam is Def breaking down and absorbing water and in places it has cracks that go down to the pipes
With that being said, customer double checked with installer to make sure he used closed cell foam, of course he did. They contacted the manufacturer and later so did I, the manufacturer which is one of the largest, said that the foam can't handle any temps over 180 degrees and that it was never designed to be placed in the ground.
Soooo.... take it for what it's worth