Primary Fermentation

I’m fairly new to brewing. Everything I’ve read and heard is that primary fermentation is over when the bubbling in the air lock stops, specific gravity is stable, and the foam falls back into the beer. The few batches I’ve made have definitely been done fermenting but there’s still always been a layer of foam on top when I rack it to a secondary or to a bottling bucket. Any idea why this is? The beer has always turned out good, so I’m not really worried about it, but I’m just curious why the foam doens’t fall back in. I’ve always had very active fermentation and it always starts within a couple hours of adding the yeast. I’m not sure if it matters. but my primary fermentation has always been in a bucket.

Surface tension?

I would not worry about it. If it falls, then you risk picking it up when you siphon. Just siphon from under it.

Or if you must, give the fermenter a gentle swirl and it will fall.

How long are you leaving it in the primary? Sounds like it may only be a few weeks.

Typically, I’ll leave most beers in the primary for about 4 weeks before racking.
There’s never any foam and this also give the yeast more time to clean up the fermentation byproducts.