In a 2012 interview, Mel Brooks said that he wasn't allowed to sell Spaceballs merchandise because of an agreement with George Lucas and "Star Wars":
AVC: That’s a real thing now, by the way. People sell headphones that look like the Princess Leia buns.
MB: Incredible. I wasn’t allowed to do any merchandising. Even though my character said, “Merchandising, merchandising, the thing that really makes money.” I wasn’t allowed to do that. My deal with Star Wars was “no action figures.” Because mine were like, Dark Helmet. Rick Moranis was in this giant helmet head. No merchandising. I said okay.
As far as I understand it, the deal basically was "we don't sue the heck out of you for using our intellectual property (parody or not), if you don't compete with us on the toy shelves". Additionally, George Lucas' company was hired to do the post production of the movie:
AVC: Was that because George Lucas had sold merchandise, and the studios were apprehensive about a similar deal?
MB: Oh, absolutely. Fox and Lucas were making a fortune, and this really, you know, was stealing. [Laughs.] I stole a lot, and I satirize it, but the script was different. And [George Lucas] loves it. He loves the film. I was very wise. You know what I did not to have any real trouble? I called Lucas and I said, “I want you guys up in San Francisco—at the ranch or whatever—to do all the post-production of the movie. And he said, “Oh, great, great.” So, there may have been five million bucks in post-production on that, and special effects, etc., that Lucas handled. So, it was wise, you know? I was playing ball with the people who could have said no. [Laughs.] He wouldn’t have sued me anyway. He’s not that kind of guy. He wrote me a lovely note saying me how much he loved the picture. He said it’s dangerous comedy. He said, “I was afraid I would bust something from laughing.” Which is a lovely note.
Today, you can find some Spaceballs merchandise on the respective platforms, like shirts and mugs and stickers and so on. But I have my doubts about the legality of those products. Probably, neither George Lucas / Disney nor Mel Brooks authorized those ;)