In my SharePoint online, external sharing is enabled and I am able to share files externally but in the same site and documents library when I am trying to share folder, the anyone with link sharing link is grey out.
Please refer to the following documents , and try to follow the solution in the documents to test . Hope it can help you.
Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.