RFC 1123 relaxes a constraint of RFC 952 which specifies a legacy of the Hostname Server Protocol (described in RFC 953) replaced by DNS.
So a fully numeric hostname would be valid per these RFCs.
RFC 1123 itself discusses consequences when it comes to IP versus hostname parsing :
If a dotted-decimal number can be entered without such
identifying delimiters, then a full syntactic check must be
made, because a segment of a host domain name is now allowed
to begin with a digit and could legally be entirely numeric
(see Section 6.1.2.4). However, a valid host name can never
have the dotted-decimal form #.#.#.#, since at least the
highest-level component label will be alphabetic.
However, it was provided in RFC 1178 guidelines to choose a valid hostname because of implementations issues. A lot of these implementations don't recognize numeric hostnames well and try to parse them as if they were IPs until they contain at least one non-numeric character no matter the location.
Also, you will find that implementations don't always honor other original constraints of RFC 952, allowing for instance the hostname to end with a minus sign or a period.
DNS preserved these original specifications for hostnames and added support for underscores (RFC 2782).
Update As requested in comments, clarification for the sentence : However, a valid host name can never have the dotted-decimal form #.#.#.#, since at least the highest-level component label will be alphabetic. This means the top level domain name must be alphabetic, thus the fully qualified hostname can never be confused with an IPv4 address. This idea has been clarified by RFC 3696 for DNS and changed to not all-numeric. Note the slight difference.