It depends on their ancestry... There are two basic types... those from lineage at the top of the food chain (lions, etc..), and those not at the top (bobcats, lynx, etc.).
Most are not from the top, and are content and comfortable "hiding in the tall grass"... which a cardboard box is perfect at emulating. Those from ancestry at the top of the food chain would rather sit on top of the box, holding reign over their territory, and are not happy being confined or trapped in an enclosed area. These cats want high ground. the former types prefer low ground with cover.
I think my cat only likes boxes cuz he is curious as to whether it has food he likes in it or not. They never do, but he has to inspect it inside and out then hop in to see and then back out to look at me as if I am mean and cruel for not overfeeding him.
And then, sometimes, he pees on them, cuz he's just weird like that.
Do you have more than 1 cat? Almost all "peeing outside the litter boxes" problems are solved this way:
Have 1 litter box in the house for each cat, plus 1 more box. So, 1 cat = 2 boxes. 3 cats = 4 boxes. The boxes should not just sit next to each other (but in a small apartment they can).. in a multilevel house, there should be at least 1 box on each level.
The cleaner you keep the boxes, the less likely an "accident" will happen. Keep in mind, the more boxes you have, the less soiled they get over time.. so, easier to clean.
If any cat pees outside of a sufficient number of boxes, there is a good chance there is a medical issue, such as an urinary infection.
If any cat shits outside of a sufficient number of boxes, there is a VERY good chance there is a SERIOUS medical problem.
this is the most common self-induced problem cat owners have. It is understandable too... no one wants litter boxes all over their house. But, if you keep them clean (like scoop them every other day at the very least), they shouldn't be a problem.
I have 3 cats and 6 boxes. 3 are in the basement, 1 on the main floor, and 2 on the upper level. They have no "favorite box"... it seems that after scooping, whichever box is used first, all the other cats use that box to some point, and then someone moves on to another box.... meanwhile, our girl-cat always uses whatever box the boys have not yet used.
they clearly are very particular... and for the benefit of never having to get up in the freezing rain and walk your cat every day and pickup their poop off the street, it really is worth giving them what they need to be happy with that.