Allowed
Come to the US on ESTA => Get married => Leave on time => Go through CR-1 visa process
Not allowed
Come to the US on ESTA => Get married => Stay in the US and try adjusting status to get GC
Remarks
Now, if CBP learns fiance is about to get married in the US, they may not let person in as the may not believe they'll leave on time.
Also, fiance should give truthful answers to any questions by CBP. If caught on lying (misrepresentation) this will have complications in any future immigration process.