When a trademark bears the R mark, it means that it has been registered and/or approved in China and is protected by law. Any infringement is illegal.
When a trademark is marked with TM, it can only show that the trademark is the trademark of this commodity or enterprise. Whether it has been approved and registered by the State Trademark Office is not obvious from the surface. All registered trademarks (marked with R) can be found on the website of the State Trademark Office, but TM can't be found. It may be registered, or applying, or there is no trademark applied for registration at all.
As for why the same commodity package has R and TM, there are different situations. It may be that no commodity was specified when the application was submitted, it may be that the trademark application is still under trial, or it may be that TM was printed on the carton because it was not approved when the order was placed for printing, and it may not be necessary to print R after it was approved. Please call the manufacturer for details.