Why is Instagram behaving inconsistently for non-existent pages?

For some pages Instagram tells us:

Unfortunately, this page is not available.
The link you followed may be broken
or the page may have been removed. Go back to Instagram.

This is the user interface. However, when I look at my browser's network tab, I sometimes see that 200 is returned and sometimes 404.

We have programmed a simple utility that reads the HTTP status code of the response for some pages, and this inconsistent behavior has caused us many problems.

Does anyone know why Instagram acts like this? Of course we can change our code, but I'm wondering if returning different codes means different page statistics. I guess if Instagram returns 200 for page and says that it does not exist, the page exists in the database but is no longer active or disabled, or something similar. Is there a way to find out?