Well yeah of course you can. The pi 400 is even an official computer kit turning it into a homecomputer akin to a commdore 64/amiga 500/acorn/bbc micro etc.
That’s a poor analogy given that the Pi 5 & Pi 400 are incomparably more powerful than 1980s home computers, and I don’t think OP was asking if a Pi 5 can run WordPerfect or VisiCalc.