It gives both the employer and the candidate a chance to evaluate each other in context.
As an employer, you get to see how the candidate performs on two different real-world tasks, as well as how they interact with existing employees.
As an employee, you get to see what the company is really like to work with. No amount of whiteboarding can deliver that.
And at the end of the day, if that relationship feels good, both parties can choose to continue onwards towards full employment.
On the other hand, computer science trivia, by which I mean "implement Dijkstra or quicksort on a whiteboard", is a very poor means indeed by which to test for the ability to do real-world work in a real-world context.
Sure, it's valuable to have a broad understanding of algorithms and data structures. But whiteboard interviews on those types of problems only tests how well you would do competing in an ACM (Association for Computing Machinery) challenge, not how well you can deal with "here is a totally new-to-you problem that lacks a precise solution, now work productively with a team to solve it under the constraints of an operating business"
[1] https://builttoadapt.io/the-developer-hiring-process-is-brok...
[2] https://blog.jonrshar.pe/2016/Dec/05/pivotal-interviews.html