Product Owner is not a full-time job and the amount of time requires depends on the project and its environment. They need to spend as much time as needed to do all their responsibilities which results in maximizing the value.Note that
the only reason for the Product Owner to spend time with the developers is not refactoring but also Sprint Planning, answering questions during the Sprint, helping developers adjust their work, etc.