Jerry and Elaine dated before they were friends. So at one point, there was sexual attraction.

A big reason why they were such good friends after is that the sexual tension wasn't as big an issue. They had been intimate before, so there was no mystery about that. And they had dated and it didn't work out. So they could put all that past them and not worry about things.