Why in the first sentence is possible to use infinitive and in the second one not? Can we say in the first sentence: What they did was (that) they sold the house?
I suppose you can think of “did” in #1 as an auxiliary verb, so the infinitive “sell” is used for the same reason that we say “They did sell the house” not “They did sold the house”. Of the other permutations, I would say:
“What they did was they sold the house” – Acceptable in conversational English.
“What they did was sold the house” – Substandard (though you may hear it).
“What they did was that they sold the house” – Bad English.
Sorry, I use “conversational” to include informal or chatty written English, which may be confusing. I mean it doesn’t seem very suitable for formal written English. To me, the whole “What they did was …” structure seems more conversational than formal, but if you did want to use it in more formal writing, which is not forbidden, I think the best option is the original sentence #1, “What they did was sell the house.”