My understanding is that Record.Builder exposes a pure interface, but implements it using lots of FFI magic. What keeps the interface pure and prevents the magic from blowing up is just careful implementation and testing that no side effects can be observed through the interface.
This also implies trust that whoever implemented the library took care to hide the FFI usage properly.
As was mentioned, this is somewhat analogous to how code that uses ST and memoization works: using side-effects under the hood while keeping the interface pure.